var depsRules = `
# No dependencies allowed for any of these packages.
NONE
- < container/list, container/ring,
+ < constraints, container/list, container/ring,
internal/cfg, internal/cpu, internal/goarch,
internal/goexperiment, internal/goos,
internal/goversion, internal/nettrace,
io/fs
< embed;
- unicode, fmt !< os, os/signal;
+ unicode, fmt !< net, os, os/signal;
os/signal, STR
< path/filepath
OS
< golang.org/x/sys/cpu;
+ os < internal/godebug;
+
# FMT is OS (which includes string routines) plus reflect and fmt.
# It does not include package log, which should be avoided in core packages.
strconv, unicode
mime/quotedprintable,
net/internal/socktest,
net/url,
- runtime/debug,
runtime/trace,
text/scanner,
text/tabwriter;
# executable parsing
FMT, encoding/binary, compress/zlib
+ < runtime/debug
< debug/dwarf
< debug/elf, debug/gosym, debug/macho, debug/pe, debug/plan9obj, internal/xcoff
+ < debug/buildinfo
< DEBUG;
# go parser and friends.
< C
< runtime/cgo
< CGO
- < runtime/race, runtime/msan;
+ < runtime/race, runtime/msan, runtime/asan;
# Bulk of the standard library must not use cgo.
# The prohibition stops at net and os/user.
golang.org/x/net/lif,
golang.org/x/net/route;
+ os, runtime, strconv, sync, unsafe,
+ internal/godebug
+ < internal/intern;
+
+ internal/bytealg, internal/intern, internal/itoa, math/bits, sort, strconv
+ < net/netip;
+
# net is unavoidable when doing any networking,
# so large dependencies must be kept out.
# This is a long-looking list but most of these
golang.org/x/net/dns/dnsmessage,
golang.org/x/net/lif,
golang.org/x/net/route,
+ internal/godebug,
internal/nettrace,
internal/poll,
internal/singleflight,
internal/race,
+ net/netip,
os
< net;
< crypto/subtle
< crypto/internal/subtle
< crypto/elliptic/internal/fiat
- < crypto/ed25519/internal/edwards25519/field
+ < crypto/elliptic/internal/nistec
+ < crypto/ed25519/internal/edwards25519/field, golang.org/x/crypto/curve25519/internal/field
< crypto/ed25519/internal/edwards25519
< crypto/cipher
< encoding/asn1
FMT, flag, math/rand
< testing/quick;
- FMT, flag, runtime/debug, runtime/trace, internal/sysinfo, math/rand
+ FMT, DEBUG, flag, runtime/trace, internal/sysinfo, math/rand
< testing;
- internal/testlog, runtime/pprof, regexp
+ FMT, crypto/sha256, encoding/json, go/ast, go/parser, go/token,
+ internal/godebug, math/rand, encoding/hex, crypto/sha256
+ < internal/fuzz;
+
+ internal/fuzz, internal/testlog, runtime/pprof, regexp
< testing/internal/testdeps;
OS, flag, testing, internal/cfg
}
}
-var buildIgnore = []byte("\n// +build ignore")
+var buildIgnore = []byte("\n//go:build ignore")
func findImports(pkg string) ([]string, error) {
vpkg := pkg
if err != nil {
return nil, fmt.Errorf("reading %v: %v", name, err)
}
+ if info.parsed.Name.Name == "main" {
+ continue
+ }
if bytes.Contains(info.header, buildIgnore) {
continue
}