]> Cypherpunks repositories - gostls13.git/commit
go/build: don't check if srcDir in GOPATH when deciding to use modules
authorJay Conrod <jayconrod@google.com>
Thu, 27 Jun 2019 19:28:08 +0000 (15:28 -0400)
committerJay Conrod <jayconrod@google.com>
Thu, 27 Jun 2019 19:58:49 +0000 (19:58 +0000)
commitf1a8ca30fcaa91803c353999448f6f3a292f1db1
tree6d6a41669f1f038ff80f6ab4e99d9db244d11230
parent0d4de70c1c2522bb965cb683070b316d77909649
go/build: don't check if srcDir in GOPATH when deciding to use modules

go/build.Context.Import loads package information using 'go list' when
in module mode. It does this when GO111MODULE is not "off", there is a
go.mod file in any parent directory, and neither the path nor the
source directory are in GOROOT. Import no longer checks whether the
source directory is in GOPATH if GO111MODULE=auto or unset.

Also fixed subdirectory checks that did not handle relative source
directory paths. mod_gobuild_import should have failed when we changed
the meaning of GO111MODULE=auto but didn't because of this.

Fixes #32799

Change-Id: Ic5210b7e00cb58f91ea9455b67b49d5aed4eec63
Reviewed-on: https://go-review.googlesource.com/c/go/+/184098
Run-TryBot: Jay Conrod <jayconrod@google.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
src/cmd/go/testdata/script/mod_gobuild_import.txt
src/go/build/build.go