diff --git a/go/buildutil/allpackages.go b/go/buildutil/allpackages.go index 9eb9d451..b86538ae 100644 --- a/go/buildutil/allpackages.go +++ b/go/buildutil/allpackages.go @@ -16,7 +16,7 @@ import ( "sync" ) -// AllPackagesList returns the import path of each Go package in any source +// AllPackages returns the import path of each Go package in any source // directory of the specified build context (e.g. $GOROOT or an element // of $GOPATH). Errors are ignored. The results are sorted. // @@ -26,10 +26,10 @@ import ( // All I/O is via the build.Context virtual file system, // which must be concurrency-safe. // -func AllPackagesList(ctxt *build.Context) []string { +func AllPackages(ctxt *build.Context) []string { var list []string var mu sync.Mutex - AllPackages(ctxt, func(pkg string, _ error) { + ForEachPackage(ctxt, func(pkg string, _ error) { mu.Lock() list = append(list, pkg) mu.Unlock() @@ -38,7 +38,7 @@ func AllPackagesList(ctxt *build.Context) []string { return list } -// AllPackages calls the found function with the import path of +// ForEachPackage calls the found function with the import path of // each Go package it finds in any source directory of the specified // build context (e.g. $GOROOT or an element of $GOPATH). // @@ -48,7 +48,7 @@ func AllPackagesList(ctxt *build.Context) []string { // The found function and the build.Context virtual file system // accessors must be concurrency safe. // -func AllPackages(ctxt *build.Context, found func(importPath string, err error)) { +func ForEachPackage(ctxt *build.Context, found func(importPath string, err error)) { var wg sync.WaitGroup for _, root := range ctxt.SrcDirs() { root := root diff --git a/go/buildutil/allpackages_test.go b/go/buildutil/allpackages_test.go index f68c24ae..ee741d96 100644 --- a/go/buildutil/allpackages_test.go +++ b/go/buildutil/allpackages_test.go @@ -12,7 +12,7 @@ import ( ) func TestAllPackages(t *testing.T) { - all := buildutil.AllPackagesList(&build.Default) + all := buildutil.AllPackages(&build.Default) set := make(map[string]bool) for _, pkg := range all { diff --git a/go/loader/stdlib_test.go b/go/loader/stdlib_test.go index 7c09322b..e0277751 100644 --- a/go/loader/stdlib_test.go +++ b/go/loader/stdlib_test.go @@ -39,7 +39,7 @@ func TestStdlib(t *testing.T) { ctxt := build.Default // copy ctxt.GOPATH = "" // disable GOPATH conf := loader.Config{Build: &ctxt} - for _, path := range buildutil.AllPackagesList(conf.Build) { + for _, path := range buildutil.AllPackages(conf.Build) { if err := conf.ImportWithTests(path); err != nil { t.Error(err) } diff --git a/go/pointer/stdlib_test.go b/go/pointer/stdlib_test.go index d0fd4f64..c8380148 100644 --- a/go/pointer/stdlib_test.go +++ b/go/pointer/stdlib_test.go @@ -39,7 +39,7 @@ func TestStdlib(t *testing.T) { SourceImports: true, Build: &ctxt, } - if _, err := conf.FromArgs(buildutil.AllPackagesList(conf.Build), true); err != nil { + if _, err := conf.FromArgs(buildutil.AllPackages(conf.Build), true); err != nil { t.Errorf("FromArgs failed: %v", err) return } diff --git a/go/ssa/stdlib_test.go b/go/ssa/stdlib_test.go index 14a8b54e..bfe72169 100644 --- a/go/ssa/stdlib_test.go +++ b/go/ssa/stdlib_test.go @@ -33,7 +33,7 @@ func TestStdlib(t *testing.T) { SourceImports: true, Build: &ctxt, } - if _, err := conf.FromArgs(buildutil.AllPackagesList(conf.Build), true); err != nil { + if _, err := conf.FromArgs(buildutil.AllPackages(conf.Build), true); err != nil { t.Errorf("FromArgs failed: %v", err) return } diff --git a/refactor/importgraph/graph.go b/refactor/importgraph/graph.go index 922ff9f8..bbf88799 100644 --- a/refactor/importgraph/graph.go +++ b/refactor/importgraph/graph.go @@ -88,7 +88,7 @@ func Build(ctxt *build.Context) (forward, reverse Graph, errors map[string]error }() var wg sync.WaitGroup - buildutil.AllPackages(ctxt, func(path string, err error) { + buildutil.ForEachPackage(ctxt, func(path string, err error) { if err != nil { errorc <- pathError{path, err} return