]> Cypherpunks repositories - gostls13.git/commit
cmd/gofmt: don't eat source if -w fails
authorRobert Griesemer <gri@golang.org>
Wed, 9 Nov 2016 23:29:41 +0000 (15:29 -0800)
committerRobert Griesemer <gri@golang.org>
Thu, 10 Nov 2016 00:30:18 +0000 (00:30 +0000)
commitb188b4cc110261a004674df5a4e209cc4894d314
tree16bd2be699531114409a1fb7199f2bf709671b27
parentadd8028eb9925db0ec9d3d0f95dec65c8cab1d96
cmd/gofmt: don't eat source if -w fails

Write output to a temp file first and only upon success
rename that file to source file name.

Fixes #8984.

Change-Id: Ie40e49d2a4eb3c9462fe769ccbf055b4366eceb0
Reviewed-on: https://go-review.googlesource.com/33018
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
src/cmd/gofmt/gofmt.go