#!/bin/bash # We can rewrite this bash script in Go if a dependency on bash and coreutils # is a problem during development. go_version=$(go env GOVERSION) # not "go version", to exclude GOOS/GOARCH runtime_and_deps=$(go list -deps runtime) # All packages that the runtime linknames to, except runtime and its dependencies. # This resulting list is what we need to "go list" when obfuscating the runtime, # as they are the packages that we may be missing. runtime_linknamed=$(comm -23 <( sed -rn 's@//go:linkname .* ([^.]*)\.[^.]*@\1@p' $(go env GOROOT)/src/runtime/*.go | grep -vE '^main|^runtime\.' | sort -u ) <( # Note that we assume this is constant across platforms. go list -deps runtime | sort -u )) gofmt >go_std_tables.go <