t.Errorf("unexpected dependency: %s imports %v", pkg, bad)
}
}
-
- // depPath returns the path between the given from and to packages.
- // It returns the empty string if there's no dependency path.
- var depPath func(string, string) string
- depPath = func(from, to string) string {
- if sawImport[from][to] {
- return from + " => " + to
- }
- for pkg := range sawImport[from] {
- if p := depPath(pkg, to); p != "" {
- return from + " => " + p
- }
- }
- return ""
- }
}
var buildIgnore = []byte("\n//go:build ignore")