golang/go
View on GitHubx/tools/cmd/goimports: do not prefix packages from GOROOT if it is inside a module
Open
#31,206 opened on Apr 2, 2019
NeedsFixToolshelp wanted
Repository metrics
- Stars
- (133,883 stars)
- PR merge metrics
- (No merged PRs in 30d)
Description
What version of Go are you using (go version)?
Does this issue reproduce with the latest release?
Yes.
What operating system and processor architecture are you using (go env)?
What did you do?
I have a GOROOT inside a module (a per-repository Go installation for a hermetic build).
I run goimports, it tries to resolve a package (say, reflect), it loads packages from GOROOT, and they end up being prefixed with a path inside the current module.
What did you expect to see?
package mypkg
import "reflect"
type x reflect.Type
What did you see instead?
package mypkg
import "my.module/_deps/go-1.12beta2/src/reflect"
type x reflect.Type
How to fix
[Patch redacted by @bcmills. Please send a PR or CL so that we can verify CLA compliance.]