update the list of runtime-related packages for 1.16 (#246)

With a few extra lines, we can keep Go 1.15 support in the table too.

Re-enables the goprivate.txt test for Go 1.16.

While at it, make the script's use of grep a bit simpler with -E, which
also uses the same syntax as Go's regexp. Its skip logic was also buggy,
resulting in the macos results always being empty.

Updates #124.
pull/247/head
Daniel Martí 5 years ago committed by GitHub
parent 89dbdb69a1
commit 5e3ba2fc09
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -719,13 +719,14 @@ func (tf *transformer) handleDirectives(comments []string) {
// Once we support go:linkname well and once we can obfuscate the runtime // Once we support go:linkname well and once we can obfuscate the runtime
// package, this entire map can likely go away. // package, this entire map can likely go away.
// //
// The list was obtained via scripts/runtime-related.sh on Go 1.15.5. // The list was obtained via scripts/runtime-related.sh on Go 1.16.
var runtimeRelated = map[string]bool{ var runtimeRelated = map[string]bool{
"bufio": true, "bufio": true,
"bytes": true, "bytes": true,
"compress/flate": true, "compress/flate": true,
"compress/gzip": true, "compress/gzip": true,
"context": true, "context": true,
"crypto/x509/internal/macos": true,
"encoding/binary": true, "encoding/binary": true,
"errors": true, "errors": true,
"fmt": true, "fmt": true,
@ -734,10 +735,12 @@ var runtimeRelated = map[string]bool{
"internal/bytealg": true, "internal/bytealg": true,
"internal/cpu": true, "internal/cpu": true,
"internal/fmtsort": true, "internal/fmtsort": true,
"internal/nettrace": true,
"internal/oserror": true, "internal/oserror": true,
"internal/poll": true, "internal/poll": true,
"internal/race": true, "internal/race": true,
"internal/reflectlite": true, "internal/reflectlite": true,
"internal/singleflight": true,
"internal/syscall/execenv": true, "internal/syscall/execenv": true,
"internal/syscall/unix": true, "internal/syscall/unix": true,
"internal/syscall/windows": true, "internal/syscall/windows": true,
@ -746,12 +749,13 @@ var runtimeRelated = map[string]bool{
"internal/testlog": true, "internal/testlog": true,
"internal/unsafeheader": true, "internal/unsafeheader": true,
"io": true, "io": true,
"io/ioutil": true, "io/fs": true,
"math": true, "math": true,
"math/bits": true, "math/bits": true,
"net": true,
"os": true, "os": true,
"os/signal": true, "os/signal": true,
"path/filepath": true, "path": true,
"plugin": true, "plugin": true,
"reflect": true, "reflect": true,
"runtime": true, "runtime": true,
@ -760,6 +764,7 @@ var runtimeRelated = map[string]bool{
"runtime/internal/atomic": true, "runtime/internal/atomic": true,
"runtime/internal/math": true, "runtime/internal/math": true,
"runtime/internal/sys": true, "runtime/internal/sys": true,
"runtime/metrics": true,
"runtime/pprof": true, "runtime/pprof": true,
"runtime/trace": true, "runtime/trace": true,
"sort": true, "sort": true,
@ -774,6 +779,17 @@ var runtimeRelated = map[string]bool{
"unicode/utf16": true, "unicode/utf16": true,
"unicode/utf8": true, "unicode/utf8": true,
"unsafe": true, "unsafe": true,
"vendor/golang.org/x/net/dns/dnsmessage": true,
"vendor/golang.org/x/net/route": true,
// These packages were moved in Go 1.16, but 1.15's runtime still
// linknames to them.
"io/ioutil": true,
"path/filepath": true,
// Go 1.15's "net" package depends on "math/rand", but 1.16's does not.
// Keep it here to support 1.15.
"math/rand": true,
} }
// isPrivate checks if GOPRIVATE matches path. // isPrivate checks if GOPRIVATE matches path.

@ -10,10 +10,10 @@ go version
echo echo
for GOOS in linux darwin windows; do for GOOS in linux darwin windows; do
skip="macos" skip="|macos"
if [[ $GOOS == "darwin" ]]; then if [[ $GOOS == "darwin" ]]; then
skip="" skip=""
fi fi
GOOS=$GOOS go list -deps $(sed -rn 's@//go:linkname .* ([^.]*)\.[^.]*@\1@p' $(go env GOROOT)/src/runtime/*.go | grep -v '^main\|\.\|js\|'$skip) runtime || exit 1 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 done | sort -u

@ -8,8 +8,6 @@ stderr '^public package "test/main/importer" can''t depend on obfuscated package
[short] stop [short] stop
[go1.16] skip 'TODO(mvdan): fix for Go 1.16'
# Try garbling all of std, given some std packages. # Try garbling all of std, given some std packages.
# No need for a main package here; building the std packages directly works the # No need for a main package here; building the std packages directly works the
# same, and is faster as we don't need to link a binary. # same, and is faster as we don't need to link a binary.

Loading…
Cancel
Save