You cannot select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
	
	
		
			56 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			Plaintext
		
	
		
		
			
		
	
	
			56 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			Plaintext
		
	
| 
								 
											4 years ago
										 
									 | 
							
								# test that we used all necessary dependencies
							 | 
						||
| 
								 | 
							
								[linux] exec bash runtime-related-tested.sh
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								env GOPRIVATE=*
							 | 
						||
| 
								 | 
							
								garble build
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								-- runtime-related.sh --
							 | 
						||
| 
								 | 
							
								for GOOS in linux darwin windows; do
							 | 
						||
| 
								 | 
							
									skip="|macos"
							 | 
						||
| 
								 | 
							
									if [[ $GOOS == "darwin" ]]; then
							 | 
						||
| 
								 | 
							
										skip=""
							 | 
						||
| 
								 | 
							
									fi
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
									GOOS=$GOOS go list -deps $(sed -rn 's@//go:linkname .* ([^.]*)\.[^.]*@\1@p' $(go env GOROOT)/src/runtime/*.go | grep -vE '^main|^runtime\.|js'$skip) runtime || exit 1
							 | 
						||
| 
								 | 
							
								done | sort -u
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								-- runtime-related-tested.sh --
							 | 
						||
| 
								 | 
							
								# get all runtime-related deps
							 | 
						||
| 
								 | 
							
								related=$(bash runtime-related.sh) || exit 1
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								# get all tested deps
							 | 
						||
| 
								 | 
							
								tested=$(for GOOS in linux darwin windows; do GOOS=$GOOS go list -deps || exit 1; done | sort -u)
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								# remove all tested deps from the runtime-related deps 
							 | 
						||
| 
								 | 
							
								output=$(echo "$related" | grep -Fvx -e "$tested")
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								# output should be empty if all runtime-related deps are tested
							 | 
						||
| 
								 | 
							
								[[ -z "$output" ]] || (echo "$output" && exit 1)
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								-- go.mod --
							 | 
						||
| 
								 | 
							
								module test/main
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								go 1.17
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								-- main.go --
							 | 
						||
| 
								 | 
							
								package main
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								import (
							 | 
						||
| 
								 | 
							
									"net/http/pprof"
							 | 
						||
| 
								 | 
							
									"os/signal"
							 | 
						||
| 
								 | 
							
									"plugin"
							 | 
						||
| 
								 | 
							
									"runtime/debug"
							 | 
						||
| 
								 | 
							
									"runtime/metrics"
							 | 
						||
| 
								 | 
							
									"text/tabwriter"
							 | 
						||
| 
								 | 
							
								)
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								// This program imports all runtime-related dependencies (proven by runtime-related-tested.sh)
							 | 
						||
| 
								 | 
							
								func main() {
							 | 
						||
| 
								 | 
							
									_ = tabwriter.AlignRight
							 | 
						||
| 
								 | 
							
									signal.Ignore()
							 | 
						||
| 
								 | 
							
									_ = plugin.Plugin{}
							 | 
						||
| 
								 | 
							
									_ = pprof.Handler("")
							 | 
						||
| 
								 | 
							
									_ = debug.GCStats{}
							 | 
						||
| 
								 | 
							
									metrics.All()
							 | 
						||
| 
								 | 
							
								}
							 |