• Robert Griesemer's avatar
    cmd/gofmt: don't overwrite read-only files · 35ea53dc
    Robert Griesemer authored
    This reverts the changes from https://golang.org/cl/33018: Instead
    of writing the result of gofmt to a tmp file and then rename that
    to the original (which doesn't preserve the original file's perm
    bits, uid, gid, and possibly other properties because it is hard
    to do in a platform-independent way - see #17869), use the original
    code that simply overwrites the processed file if gofmt was able to
    create a backup first. Upon success, the backup is removed, otherwise
    it remains.
    
    Fixes #17873.
    For #8984.
    
    Change-Id: Ifcf2bf1f84f730e6060f3517d63b45eb16215ae1
    Reviewed-on: https://go-review.googlesource.com/33098
    Run-TryBot: Robert Griesemer <gri@golang.org>
    Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    35ea53dc
Name
Last commit
Last update
.github Loading commit data...
api Loading commit data...
doc Loading commit data...
lib/time Loading commit data...
misc Loading commit data...
src Loading commit data...
test Loading commit data...
.gitattributes Loading commit data...
.gitignore Loading commit data...
AUTHORS Loading commit data...
CONTRIBUTING.md Loading commit data...
CONTRIBUTORS Loading commit data...
LICENSE Loading commit data...
PATENTS Loading commit data...
README.md Loading commit data...
favicon.ico Loading commit data...
robots.txt Loading commit data...