Skip to content

Commit b39cea3

Browse files
committed
cmd/go/internal/vgo: do not shadow GOPATH dir var
Allows actually detecting GOPATH paths without a package import comment. Previously it may have appeared to work by detecting github path. Fixes golang/go#25176 Change-Id: I9b96e2b6c6c776a54d4fb1a996dabc02f92bd8ac Reviewed-on: https://go-review.googlesource.com/111264 Reviewed-by: Brad Fitzpatrick <[email protected]>
1 parent 9271c4f commit b39cea3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

vendor/cmd/go/internal/vgo/init.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -242,8 +242,8 @@ func FindModuleRoot(dir, limit string, legacyConfigOK bool) (root, file string)
242242

243243
// Exported only for testing.
244244
func FindModulePath(dir string) (string, error) {
245-
for _, dir := range filepath.SplitList(cfg.BuildContext.GOPATH) {
246-
src := filepath.Join(dir, "src") + string(filepath.Separator)
245+
for _, gpdir := range filepath.SplitList(cfg.BuildContext.GOPATH) {
246+
src := filepath.Join(gpdir, "src") + string(filepath.Separator)
247247
if strings.HasPrefix(dir, src) {
248248
return filepath.ToSlash(dir[len(src):]), nil
249249
}

0 commit comments

Comments
 (0)