1
0
mirror of https://github.com/golang/go synced 2024-11-18 01:04:48 -07:00

internal/imports: use ProcessEnv to filter files

In CL 247797 I accidentally used the default build.Context instead of
one generated from the ProcessEnv to match files. This has essentially
no effect because we only allow overriding GOROOT and GOPATH, but it's
still a mistake.

Change-Id: Ibe23c97590fe21609252f048bc2e925f3043dec4
Reviewed-on: https://go-review.googlesource.com/c/tools/+/255777
Trust: Heschi Kreinick <heschi@google.com>
Run-TryBot: Heschi Kreinick <heschi@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
This commit is contained in:
Heschi Kreinick 2020-09-17 16:11:10 -04:00
parent 75ebdcb73b
commit 0511c4cc7a

View File

@ -827,7 +827,11 @@ func (e *ProcessEnv) goEnv() (map[string]string, error) {
}
func (e *ProcessEnv) matchFile(dir, name string) (bool, error) {
return build.Default.MatchFile(dir, name)
bctx, err := e.buildContext()
if err != nil {
return false, err
}
return bctx.MatchFile(dir, name)
}
// CopyConfig copies the env's configuration into a new env.