]> Cypherpunks repositories - gostls13.git/commit
cmd/go/internal/cache: avoid ioutil.WriteFile for writing cache entries
authorBryan C. Mills <bcmills@google.com>
Fri, 26 Jul 2019 00:26:46 +0000 (20:26 -0400)
committerBryan C. Mills <bcmills@google.com>
Tue, 30 Jul 2019 20:16:40 +0000 (20:16 +0000)
commit2fc7574aab072c697d2d020fa48347b0c1b221e7
tree8772768cd62effdf47a16c42e2efde4a2c841fec
parent8c3040d768e70fd6cf9f992fe4745edbf51bc581
cmd/go/internal/cache: avoid ioutil.WriteFile for writing cache entries

ioutil.WriteFile always truncates the destination file to 0 before
writing, which is inappropriate for unsynchronized, idempotent,
fixed-size files such as the cache entry files here.

Instead, truncate the file only after writing it, so that a second
write will never (even temporarily!) remove the contents of a
preceding write.

Fixes #29667

Change-Id: I16a53ce79d8a23d23580511cb6abd062f54b65ef
Reviewed-on: https://go-review.googlesource.com/c/go/+/188157
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
src/cmd/go/internal/cache/cache.go
src/cmd/go/testdata/script/mod_list_compiled_concurrent.txt [new file with mode: 0644]