diff --git a/hash.go b/hash.go index f7ccc5b..bd7136e 100644 --- a/hash.go +++ b/hash.go @@ -118,7 +118,11 @@ func appendFlags(w io.Writer, forBuildHash bool) { if flagTiny { io.WriteString(w, " -tiny") } - if flagDebug { + if flagDebug && !forBuildHash { + // -debug doesn't affect the build result at all, + // so don't give it separate entries in the build cache. + // If the user really wants to see debug info for already built deps, + // they can use "go clean cache" or the "-a" build flag to rebuild. io.WriteString(w, " -debug") } if flagDebugDir != "" && !forBuildHash { diff --git a/testdata/scripts/debugdir.txt b/testdata/scripts/debugdir.txt index a586d21..75e52f1 100644 --- a/testdata/scripts/debugdir.txt +++ b/testdata/scripts/debugdir.txt @@ -1,8 +1,5 @@ env GOGARBLE=* -# ! garble -debug -debugdir ./debug1 build -# cp stderr /tmp/log -# exit garble -debugdir ./debug1 build exists 'debug1/test/main/imported/imported.go' 'debug1/test/main/main.go' 'debug1/reflect/type.go' ! grep ImportedFunc $WORK/debug1/test/main/imported/imported.go