aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarlos Amedee <carlos@golang.org>2019-11-27 18:31:36 +0000
committerCarlos Amedee <carlos@golang.org>2019-11-27 20:27:15 +0000
commit9174e2c03c423a47bf052b8a1aa844f3378eccd4 (patch)
tree7ef835242a15111c2578abcb51cc6967b13e0de2 /src
parentf1c8e2c14ad3e9d0fa62a4698163138e6fb9f7a4 (diff)
downloadgo-9174e2c03c423a47bf052b8a1aa844f3378eccd4.tar.xz
cmd/go/internal/modget: synchronize writes to modOnly map in runGet
Adds an additional lock around an access to modOnly. Updates #35317 Change-Id: Ia1e75f9a674ec2a2c0489b41283c1cd3e7924d1e Reviewed-on: https://go-review.googlesource.com/c/go/+/209237 Run-TryBot: Jay Conrod <jayconrod@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Jay Conrod <jayconrod@google.com>
Diffstat (limited to 'src')
-rw-r--r--src/cmd/go/internal/modget/get.go2
-rw-r--r--src/cmd/go/testdata/script/mod_issue35317.txt2
2 files changed, 3 insertions, 1 deletions
diff --git a/src/cmd/go/internal/modget/get.go b/src/cmd/go/internal/modget/get.go
index 9a6b29350a..2a0f634658 100644
--- a/src/cmd/go/internal/modget/get.go
+++ b/src/cmd/go/internal/modget/get.go
@@ -458,7 +458,9 @@ func runGet(cmd *base.Command, args []string) {
modOnly := make(map[string]*query)
for _, q := range queries {
if q.m.Version == "none" {
+ modOnlyMu.Lock()
modOnly[q.m.Path] = q
+ modOnlyMu.Unlock()
continue
}
if q.path == q.m.Path {
diff --git a/src/cmd/go/testdata/script/mod_issue35317.txt b/src/cmd/go/testdata/script/mod_issue35317.txt
index 003390b710..92416a54e4 100644
--- a/src/cmd/go/testdata/script/mod_issue35317.txt
+++ b/src/cmd/go/testdata/script/mod_issue35317.txt
@@ -5,4 +5,4 @@ env GO111MODULE=on
[short] skip
go mod init example.com
-go get golang.org/x/text@v0.3.0 golang.org/x/internal@v0.1.0
+go get golang.org/x/text@v0.3.0 golang.org/x/internal@v0.1.0 golang.org/x/exp@none