diff options
| author | Benoit Sigoure <tsunanet@gmail.com> | 2016-02-05 17:18:46 -0800 |
|---|---|---|
| committer | Robert Griesemer <gri@golang.org> | 2016-02-19 00:13:18 +0000 |
| commit | 3ddfaa5653cfc5c8663319d017a5fb4de97814f4 (patch) | |
| tree | 5ee9978bb10539ed8bf46e22f25b281cc4df53d1 /src | |
| parent | 2eeaaaae7530337c23b0d4d76ac519e677c125dd (diff) | |
| download | go-3ddfaa5653cfc5c8663319d017a5fb4de97814f4.tar.xz | |
cmd/gofmt: Ignore file not found errors.
gofmt prints an error to stderr when a file is deleted during its
`filepath.Walk()', which can happen in builds that change the tree
concurrently with gofmt running.
Change-Id: Ia1aa4804f6bc2172baf061c093e16fe56a3ee50c
Reviewed-on: https://go-review.googlesource.com/19301
Reviewed-by: Robert Griesemer <gri@golang.org>
Diffstat (limited to 'src')
| -rw-r--r-- | src/cmd/gofmt/gofmt.go | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/cmd/gofmt/gofmt.go b/src/cmd/gofmt/gofmt.go index cfebeffe4a..b10b804fd2 100644 --- a/src/cmd/gofmt/gofmt.go +++ b/src/cmd/gofmt/gofmt.go @@ -143,7 +143,9 @@ func visitFile(path string, f os.FileInfo, err error) error { if err == nil && isGoFile(f) { err = processFile(path, nil, os.Stdout, false) } - if err != nil { + // Don't complain if a file was deleted in the meantime (i.e. + // the directory changed concurrently while running gofmt). + if err != nil && !os.IsNotExist(err) { report(err) } return nil |
