]> Cypherpunks repositories - gostls13.git/commit
cmd/go: allow 'go run x.go' to use nearby internal imports in module mode
authorRuss Cox <rsc@golang.org>
Sat, 18 Aug 2018 02:32:22 +0000 (22:32 -0400)
committerRuss Cox <rsc@golang.org>
Sat, 18 Aug 2018 18:22:51 +0000 (18:22 +0000)
commitcc880de4bebf9b9242a8f5d1d7e9cf01863bb701
tree247ff27ac9fb23a0770a08589cdaf76b5ef20318
parent239b8f2edc70046484d5bcc5bf0cac06f8e1ace4
cmd/go: allow 'go run x.go' to use nearby internal imports in module mode

In GOPATH mode the rule has always been that 'go run x.go' can
import whatever the package in x.go's directory would be able to
import. Apply the same rule here.

The bad import path was triggering other mysterious errors
during 'go run' in other circumstances. Setting it correctly fixes
those too.

Fixes #26046.
Fixes #27022.

Change-Id: I0a9b0a154a20f48add5a199da85572e7ffe0cde4
Reviewed-on: https://go-review.googlesource.com/129798
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
src/cmd/go/internal/load/pkg.go
src/cmd/go/internal/modload/init.go
src/cmd/go/internal/modload/load.go
src/cmd/go/testdata/script/mod_run_internal.txt [new file with mode: 0644]
src/cmd/go/testdata/script/mod_run_path.txt [new file with mode: 0644]