4dd9c7cadc
cache.Trim, dowloadZip, rewriteVersionList, writeDiskCache all use renameio.WriteFile to write their respective files to disk. For the uses in cache.Trim and downloadZip, instead do of renameio.WriteFile, do a truncate to the length of the file, then write the relevant bytes so that a corrupt file (which would contain null bytes because of the truncate) could be detected. For rewriteVersionList, use lockedfile.Transform to do the write (which does a truncate as part of the write too. writeDiskCache stays the same in this CL. Also desete renameio methods that aren't used and remove the renameio.WriteFile wrapper and just use renameio.WriteToFile which it wraps. There is a possibility of corrupt files in the cache (which was true even before this CL) so later CLs will add facilities to clear corrupt files in the cache. Change-Id: I0d0bda40095e4cb898314315bf313e71650d8d25 Reviewed-on: https://go-review.googlesource.com/c/go/+/277412 Trust: Michael Matloob <matloob@golang.org> Run-TryBot: Michael Matloob <matloob@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Bryan C. Mills <bcmills@google.com> Reviewed-by: Jay Conrod <jayconrod@google.com> |
||
---|---|---|
.github | ||
api | ||
doc | ||
lib/time | ||
misc | ||
src | ||
test | ||
.gitattributes | ||
.gitignore | ||
AUTHORS | ||
codereview.cfg | ||
CONTRIBUTING.md | ||
CONTRIBUTORS | ||
favicon.ico | ||
LICENSE | ||
PATENTS | ||
README.md | ||
robots.txt | ||
SECURITY.md |
The Go Programming Language
Go is an open source programming language that makes it easy to build simple, reliable, and efficient software.
Gopher image by Renee French, licensed under Creative Commons 3.0 Attributions license.
Our canonical Git repository is located at https://go.googlesource.com/go. There is a mirror of the repository at https://github.com/golang/go.
Unless otherwise noted, the Go source files are distributed under the BSD-style license found in the LICENSE file.
Download and Install
Binary Distributions
Official binary distributions are available at https://golang.org/dl/.
After downloading a binary release, visit https://golang.org/doc/install for installation instructions.
Install From Source
If a binary distribution is not available for your combination of operating system and architecture, visit https://golang.org/doc/install/source for source installation instructions.
Contributing
Go is the work of thousands of contributors. We appreciate your help!
To contribute, please read the contribution guidelines at https://golang.org/doc/contribute.html.
Note that the Go project uses the issue tracker for bug reports and proposals only. See https://golang.org/wiki/Questions for a list of places to ask questions about the Go language.