Skip to content

Commit 9174e2c

Browse files
committed
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 <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Jay Conrod <[email protected]>
1 parent f1c8e2c commit 9174e2c

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

src/cmd/go/internal/modget/get.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,9 @@ func runGet(cmd *base.Command, args []string) {
458458
modOnly := make(map[string]*query)
459459
for _, q := range queries {
460460
if q.m.Version == "none" {
461+
modOnlyMu.Lock()
461462
modOnly[q.m.Path] = q
463+
modOnlyMu.Unlock()
462464
continue
463465
}
464466
if q.path == q.m.Path {

src/cmd/go/testdata/script/mod_issue35317.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ env GO111MODULE=on
55
[short] skip
66

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

0 commit comments

Comments
 (0)