]> Cypherpunks repositories - gostls13.git/commit
cmd/go/internal/list: ensure that cfg.BuildMod is initialized before reading it in...
authorBryan C. Mills <bcmills@google.com>
Wed, 23 Oct 2019 20:10:55 +0000 (16:10 -0400)
committerBryan C. Mills <bcmills@google.com>
Thu, 24 Oct 2019 13:21:45 +0000 (13:21 +0000)
commitdc77dc2b9bd0f232631f683638bd7a23fab3598c
tree38481992f6b61922815a8e87368628bd79da4c21
parenta42a396846453e44ff9abadc1430a8c0c6a11e25
cmd/go/internal/list: ensure that cfg.BuildMod is initialized before reading it in 'go list -m'

The default value of cfg.BuildMod depends on the 'go' version in the
go.mod file. The go.mod file is read and parsed, and its settings are
applied, in modload.InitMod.

As it turns out, modload.Enabled does not invoke InitMod, so
cfg.BuildMod is not necessarily set even if modload.Enabled returns
true.

Updates #33848

Change-Id: I13a4dd80730528e6f1a5acc492fcfe07cb59d94e
Reviewed-on: https://go-review.googlesource.com/c/go/+/202917
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
src/cmd/go/internal/list/list.go
src/cmd/go/internal/modload/init.go
src/cmd/go/testdata/script/mod_convert_vendor_json.txt
src/cmd/go/testdata/script/mod_convert_vendor_manifest.txt
src/cmd/go/testdata/script/mod_getmode_vendor.txt
src/cmd/go/testdata/script/mod_vendor.txt
src/cmd/go/testdata/script/mod_vendor_auto.txt