diff --git a/cache/hash.go b/cache/hash.go index 4f79c31..e434f41 100644 --- a/cache/hash.go +++ b/cache/hash.go @@ -11,7 +11,6 @@ import ( "hash" "io" "os" - "runtime" "strings" "sync" ) @@ -29,22 +28,6 @@ type Hash struct { buf *bytes.Buffer // for verify } -// hashSalt is a salt string added to the beginning of every hash -// created by NewHash. Using the Go version makes sure that different -// versions of the go command (or even different Git commits during -// work on the development branch) do not address the same cache -// entries, so that a bug in one version does not affect the execution -// of other versions. This salt will result in additional ActionID files -// in the cache, but not additional copies of the large output files, -// which are still addressed by unsalted SHA256. -// -// We strip any GOEXPERIMENTs the go tool was built with from this -// version string on the assumption that they shouldn't affect go tool -// execution. This allows bootstrapping to converge faster: dist builds -// go_bootstrap without any experiments, so by stripping experiments -// go_bootstrap and the final go binary will use the same salt. -var hashSalt = []byte(stripExperiment(runtime.Version())) - // stripExperiment strips any GOEXPERIMENT configuration from the Go // version string. func stripExperiment(version string) string { @@ -81,7 +64,6 @@ func NewHash(name string) *Hash { if debugHash { fmt.Fprintf(os.Stderr, "HASH[%s]\n", h.name) } - h.Write(hashSalt) if verify { h.buf = new(bytes.Buffer) } diff --git a/cache/hash_test.go b/cache/hash_test.go index a035677..02aebad 100644 --- a/cache/hash_test.go +++ b/cache/hash_test.go @@ -11,12 +11,6 @@ import ( ) func TestHash(t *testing.T) { - oldSalt := hashSalt - hashSalt = nil - defer func() { - hashSalt = oldSalt - }() - h := NewHash("alice") h.Write([]byte("hello world")) sum := fmt.Sprintf("%x", h.Sum())