diff --git a/main.go b/main.go index 96757ef..0c2748c 100644 --- a/main.go +++ b/main.go @@ -261,7 +261,7 @@ func mainErr(args []string) error { fmt.Fprintf(os.Stderr, "could not clean up GARBLE_SHARED: %v\n", err) } // skip the trim if we didn't even start a build - if sharedCache != nil { + if sharedCache != nil && sharedCache.CacheDir != "" { fsCache, err := openCache() if err == nil { err = fsCache.Trim() diff --git a/testdata/script/goversion.txtar b/testdata/script/goversion.txtar index f32caf2..d66b3d1 100644 --- a/testdata/script/goversion.txtar +++ b/testdata/script/goversion.txtar @@ -39,6 +39,8 @@ env GARBLE_TEST_GOVERSION='go1.38.2' env TOOLCHAIN_GOVERSION='go1.38.2' ! exec garble build stderr 'Go version "go1\.38\.2" is too new; Go linker patches aren''t available for go1\.27 or later yet' +# Ensure we don't create a cache directory in the current dir. +! exists build # We should accept custom devel strings. env TOOLCHAIN_GOVERSION='go1.26.0-somecustomversion'