golang/go

x/tools/cmd/goimports: do not prefix packages from GOROOT if it is inside a module

Open

#31.206 geöffnet am 2. Apr. 2019

Auf GitHub ansehen
 (4 Kommentare) (0 Reaktionen) (0 zugewiesene Personen)Go (19.008 Forks)batch import
NeedsFixToolshelp wanted

Repository-Metriken

Stars
 (133.883 Stars)
PR-Merge-Metriken
 (Keine gemergten PRs in 30 T)

Beschreibung

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.]

Contributor Guide