From 59b36d7a3c810fb7f6854fbf50677f59ac4de1c8 Mon Sep 17 00:00:00 2001 From: Donavan Fritz Date: Sat, 14 Nov 2026 04:52:05 +0000 Subject: [PATCH] Allow non-root cleanup of checksum test cache (#3) --- 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 {