lockedfile: add Append function
This commit adds Append function to cmd/go/internal/lockedfile. It has the same behaviour as Write, except that it doesn't truncate the file if it already exists.
Refer to: https://github.com/golang/go/pull/30211 (or https://go-review.googlesource.com/c/go/+/162437)
cc @rogpeppe - note that per https://go-review.googlesource.com/c/go/+/162437 this has not been accepted upstream. So I think it comes down to working out whether we want to extend the API here not...
Thanks for your PR!
This function calls OpenFile, which is already exported, and afterwards calls io.Copy and File.Close. As far as I can tell, you can already write those eight lines of code without further API in this module. Given that this API would exist purely out of convenience for eight lines of code, I'm inclined to leave it out for now - it's already a bit of work to keep these packages up to date with usptream (see https://github.com/rogpeppe/go-internal/pull/218), so any additions or changes of our own need to be worthwhile.