Skip to content

Commit

Permalink
cmd/go/internal/modget: synchronize writes to modOnly map in runGet
Browse files Browse the repository at this point in the history
Adds an additional lock around an access to modOnly.

Updates golang#35317

Change-Id: Ia1e75f9a674ec2a2c0489b41283c1cd3e7924d1e
Reviewed-on: https://go-review.googlesource.com/c/go/+/209237
Run-TryBot: Jay Conrod <[email protected]>
TryBot-Result: Gobot Gobot <[email protected]>
Reviewed-by: Jay Conrod <[email protected]>
  • Loading branch information
cagedmantis committed Nov 27, 2019
1 parent f1c8e2c commit 9174e2c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/cmd/go/internal/modget/get.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/go/testdata/script/mod_issue35317.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ env GO111MODULE=on
[short] skip

go mod init example.com
go get golang.org/x/[email protected] golang.org/x/[email protected]
go get golang.org/x/[email protected] golang.org/x/[email protected] golang.org/x/exp@none

0 comments on commit 9174e2c

Please sign in to comment.