Skip to content

Commit 828a107

Browse files
committed
go/packages: use correct "std" heuristic
Fixes golang/go#75901 Change-Id: I7986a2950e30bea85e2f22eae98f11b1159cbe13 Reviewed-on: https://go-review.googlesource.com/c/tools/+/711862 Auto-Submit: Alan Donovan <adonovan@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Daniel McCarney <daniel@binaryparadox.net>
1 parent 7d9453c commit 828a107

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

go/packages/packages_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import (
2626

2727
"github.com/google/go-cmp/cmp"
2828
"golang.org/x/tools/go/packages"
29+
"golang.org/x/tools/internal/packagepath"
2930
"golang.org/x/tools/internal/packagesinternal"
3031
"golang.org/x/tools/internal/packagestest"
3132
"golang.org/x/tools/internal/testenv"
@@ -3268,7 +3269,7 @@ func Foo() int { return a.Foo() }
32683269
type result struct{ Dir, ForTest string }
32693270
got := make(map[string]result)
32703271
for pkg := range packages.Postorder(pkgs) {
3271-
if strings.Contains(pkg.PkgPath, ".") { // ignore std
3272+
if !packagepath.IsStdPackage(pkg.PkgPath) {
32723273
rel, err := filepath.Rel(dir, pkg.Dir)
32733274
if err != nil {
32743275
t.Errorf("Rel(%q, %q) failed: %v", dir, pkg.Dir, err)

0 commit comments

Comments
 (0)