Commit 9174e2c0 authored by Carlos Amedee's avatar Carlos Amedee

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: default avatarJay Conrod <jayconrod@google.com>
parent f1c8e2c1
...@@ -458,7 +458,9 @@ func runGet(cmd *base.Command, args []string) { ...@@ -458,7 +458,9 @@ func runGet(cmd *base.Command, args []string) {
modOnly := make(map[string]*query) modOnly := make(map[string]*query)
for _, q := range queries { for _, q := range queries {
if q.m.Version == "none" { if q.m.Version == "none" {
modOnlyMu.Lock()
modOnly[q.m.Path] = q modOnly[q.m.Path] = q
modOnlyMu.Unlock()
continue continue
} }
if q.path == q.m.Path { if q.path == q.m.Path {
......
...@@ -5,4 +5,4 @@ env GO111MODULE=on ...@@ -5,4 +5,4 @@ env GO111MODULE=on
[short] skip [short] skip
go mod init example.com 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
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment