aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Amedee <carlos@golang.org>2019-11-27 18:31:36 +0000
committerAlexander Rakoczy <alex@golang.org>2019-12-03 19:06:26 +0000
commit4f81a326d0c1e27d36254c664a349e75e638ae00 (patch)
tree1d70f130b515adf5b2629b9a51a9fc433a8cd8b9
parent674a524a3f4fa5be6f7335f292d0d7fae4e8553e (diff)
downloadgo-4f81a326d0c1e27d36254c664a349e75e638ae00.tar.gz
go-4f81a326d0c1e27d36254c664a349e75e638ae00.zip
[release-branch.go1.13] cmd/go/internal/modget: synchronize writes to modOnly map in runGet
Adds an additional lock around an access to modOnly. Updates #35317 Fixes #35318 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> (cherry picked from commit 9174e2c03c423a47bf052b8a1aa844f3378eccd4) Reviewed-on: https://go-review.googlesource.com/c/go/+/209222 Run-TryBot: Alexander Rakoczy <alex@golang.org>
-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 d234a1eb0b..314019f125 100644
--- a/src/cmd/go/internal/modget/get.go
+++ b/src/cmd/go/internal/modget/get.go
@@ -456,7 +456,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