From e8ed85d6c22d9530523315c3048ed0455d205bff Mon Sep 17 00:00:00 2001 From: Ian Alexander Date: Fri, 12 Sep 2025 18:00:02 -0400 Subject: [PATCH] cmd/go: update goSum if necessary During investigation into #74691, we found a case where the hash was missing from the goSum global var. This change updates DownloadZip to update the goSum hash if necessary when both the zipfile and ziphashfile are already present. For #74691 Change-Id: I904b7265f667256d0c60b66503a7954b467c6454 Reviewed-on: https://go-review.googlesource.com/c/go/+/705215 LUCI-TryBot-Result: Go LUCI Reviewed-by: Michael Matloob Reviewed-by: Michael Matloob --- src/cmd/go/internal/modfetch/fetch.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/cmd/go/internal/modfetch/fetch.go b/src/cmd/go/internal/modfetch/fetch.go index 5d310ccbba..9e8d3639a9 100644 --- a/src/cmd/go/internal/modfetch/fetch.go +++ b/src/cmd/go/internal/modfetch/fetch.go @@ -214,9 +214,12 @@ func DownloadZip(ctx context.Context, mod module.Version) (zipfile string, err e } ziphashfile := zipfile + "hash" - // Return without locking if the zip and ziphash files exist. + // Return early if the zip and ziphash files exist. if _, err := os.Stat(zipfile); err == nil { if _, err := os.Stat(ziphashfile); err == nil { + if !HaveSum(mod) { + checkMod(ctx, mod) + } return zipfile, nil } } -- 2.52.0