Skip to content

Commit 6e33b78

Browse files
committed
cmd/go: respect -mod=readonly when performing 'mod verify'
Fixes #31372
1 parent 049c8db commit 6e33b78

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/cmd/go/internal/modfetch/fetch.go

+4
Original file line numberDiff line numberDiff line change
@@ -479,6 +479,10 @@ func Sum(mod module.Version) string {
479479

480480
// WriteGoSum writes the go.sum file if it needs to be updated.
481481
func WriteGoSum() {
482+
if cfg.BuildMod == "readonly" {
483+
base.Fatalf("go: updates to go.sum needed, disabled by -mod=readonly")
484+
}
485+
482486
goSum.mu.Lock()
483487
defer goSum.mu.Unlock()
484488

0 commit comments

Comments
 (0)