diff options
| author | Bryan C. Mills <bcmills@google.com> | 2019-07-25 20:26:46 -0400 |
|---|---|---|
| committer | Bryan C. Mills <bcmills@google.com> | 2019-07-30 20:16:40 +0000 |
| commit | 2fc7574aab072c697d2d020fa48347b0c1b221e7 (patch) | |
| tree | 8772768cd62effdf47a16c42e2efde4a2c841fec /src/encoding/json/encode.go | |
| parent | 8c3040d768e70fd6cf9f992fe4745edbf51bc581 (diff) | |
| download | go-2fc7574aab072c697d2d020fa48347b0c1b221e7.tar.xz | |
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>
Diffstat (limited to 'src/encoding/json/encode.go')
0 files changed, 0 insertions, 0 deletions
