Skip to content

Commit

Permalink
go/build: don't check dependencies of vendored circl library
Browse files Browse the repository at this point in the history
  • Loading branch information
bwesterb authored and Lekensteyn committed Jul 3, 2024
1 parent 885e769 commit 1039543
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/go/build/deps_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -499,6 +499,11 @@ var depsRules = `
< crypto/x509
< crypto/tls;
# CIRCL
crypto, golang.org/x/sys/cpu, hash
< golang.org/x/crypto/blake2b
< golang.org/x/crypto/blake2s;
# crypto-aware packages
DEBUG, go/build, go/types, text/scanner, crypto/md5
Expand Down Expand Up @@ -730,6 +735,11 @@ func TestDependencies(t *testing.T) {
policy := depsPolicy(t)

for _, pkg := range all {
// Skip import dependency checking within the CIRCL library,
// there are too many packages.
if strings.HasPrefix(pkg, "github.com/cloudflare/circl/") {
continue
}
imports, err := findImports(pkg)
if err != nil {
t.Error(err)
Expand All @@ -740,6 +750,11 @@ func TestDependencies(t *testing.T) {
}
var bad []string
for _, imp := range imports {
// TODO Remove this exception for github.com/cloudflare/circl
// and add CIRCL to the dependency graph specified by `depsRules`.
if strings.HasPrefix(imp, "github.com/cloudflare/circl/") {
continue
}
sawImport[pkg][imp] = true
if !policy.HasEdge(pkg, imp) {
bad = append(bad, imp)
Expand All @@ -755,7 +770,7 @@ var buildIgnore = []byte("\n//go:build ignore")

func findImports(pkg string) ([]string, error) {
vpkg := pkg
if strings.HasPrefix(pkg, "golang.org") {
if strings.HasPrefix(pkg, "golang.org") || strings.HasPrefix(pkg, "github.com") {
vpkg = "vendor/" + pkg
}
dir := filepath.Join(Default.GOROOT, "src", vpkg)
Expand Down

0 comments on commit 1039543

Please sign in to comment.