From 6a0e073ed34c4f58c888b54a65720276c5cc523c Mon Sep 17 00:00:00 2001 From: Donavan Fritz Date: Fri, 13 Nov 2026 22:49:58 -0600 Subject: [PATCH] Keep temporary module caches removable by non-root tests --- tools/private-modules/main_test.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/private-modules/main_test.go b/tools/private-modules/main_test.go index c94cd1c..cab360d 100644 --- a/tools/private-modules/main_test.go +++ b/tools/private-modules/main_test.go @@ -106,10 +106,12 @@ func TestNativeGoSumRejectsChangedModuleArtifact(t *testing.T) { } mustFixture(t, os.WriteFile(base+".zip", archive.Bytes(), 0600)) mustFixture(t, os.WriteFile(filepath.Join(root, "go.mod"), []byte("module example.invalid/checksum\n\ngo 1.27.0\n\nrequire "+modulePath+" "+version+"\n"), 0600)) + // Keep this isolated fixture cache removable by a non-root test process. + // Module content checksum validation is unchanged. run := func(cache string) ([]byte, error) { cmd := exec.Command("go", "mod", "download", modulePath+"@"+version) cmd.Dir = root - cmd.Env = append(os.Environ(), "GO111MODULE=on", "GOMODCACHE="+filepath.Join(root, cache), "GOPROXY=file://"+proxy, "GONOPROXY=none", "GONOSUMDB="+privatePrefix, "GOSUMDB=off", "GOTOOLCHAIN=local", "GOFLAGS=", "GOWORK=off") + cmd.Env = append(os.Environ(), "GO111MODULE=on", "GOMODCACHE="+filepath.Join(root, cache), "GOPROXY=file://"+proxy, "GONOPROXY=none", "GONOSUMDB="+privatePrefix, "GOSUMDB=off", "GOTOOLCHAIN=local", "GOFLAGS=-modcacherw", "GOWORK=off") return cmd.CombinedOutput() } if output, err := run("original-cache"); err != nil {