diff options
author | Russ Cox <rsc@golang.org> | 2011-11-01 22:06:05 -0400 |
---|---|---|
committer | Russ Cox <rsc@golang.org> | 2011-11-01 22:06:05 -0400 |
commit | bff16976d902e297999e2813ead7f161ab619f18 (patch) | |
tree | a72976dffc1751229bb1f25a64290af6928e9be6 /src/cmd/gofmt | |
parent | 35b030f60c6ba41d1f003cfca5cca64e025a51e8 (diff) | |
download | go-bff16976d902e297999e2813ead7f161ab619f18.tar.gz |
non-pkg: gofix -r error -force=error
R=golang-dev, iant, r, r
CC=golang-dev
http://codereview.appspot.com/5307066
Diffstat (limited to 'src/cmd/gofmt')
-rw-r--r-- | src/cmd/gofmt/gofmt.go | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/cmd/gofmt/gofmt.go b/src/cmd/gofmt/gofmt.go index 6ce99113e..f5afa6f91 100644 --- a/src/cmd/gofmt/gofmt.go +++ b/src/cmd/gofmt/gofmt.go @@ -49,7 +49,7 @@ var ( printerMode uint ) -func report(err os.Error) { +func report(err error) { scanner.PrintError(os.Stderr, err) exitCode = 2 } @@ -86,7 +86,7 @@ func isGoFile(f *os.FileInfo) bool { } // If in == nil, the source is the contents of the file with the given filename. -func processFile(filename string, in io.Reader, out io.Writer, stdin bool) os.Error { +func processFile(filename string, in io.Reader, out io.Writer, stdin bool) error { if in == nil { f, err := os.Open(filename) if err != nil { @@ -156,7 +156,7 @@ func processFile(filename string, in io.Reader, out io.Writer, stdin bool) os.Er return err } -func visitFile(path string, f *os.FileInfo, err os.Error) os.Error { +func visitFile(path string, f *os.FileInfo, err error) error { if err == nil && isGoFile(f) { err = processFile(path, nil, os.Stdout, false) } @@ -225,7 +225,7 @@ func gofmtMain() { } } -func diff(b1, b2 []byte) (data []byte, err os.Error) { +func diff(b1, b2 []byte) (data []byte, err error) { f1, err := ioutil.TempFile("", "gofmt") if err != nil { return @@ -255,7 +255,7 @@ func diff(b1, b2 []byte) (data []byte, err os.Error) { // parse parses src, which was read from filename, // as a Go source file or statement list. -func parse(filename string, src []byte, stdin bool) (*ast.File, func(orig, src []byte) []byte, os.Error) { +func parse(filename string, src []byte, stdin bool) (*ast.File, func(orig, src []byte) []byte, error) { // Try as whole source file. file, err := parser.ParseFile(fset, filename, src, parserMode) if err == nil { @@ -264,7 +264,7 @@ func parse(filename string, src []byte, stdin bool) (*ast.File, func(orig, src [ // If the error is that the source file didn't begin with a // package line and this is standard input, fall through to // try as a source fragment. Stop and return on any other error. - if !stdin || !strings.Contains(err.String(), "expected 'package'") { + if !stdin || !strings.Contains(err.Error(), "expected 'package'") { return nil, nil, err } @@ -286,7 +286,7 @@ func parse(filename string, src []byte, stdin bool) (*ast.File, func(orig, src [ // If the error is that the source file didn't begin with a // declaration, fall through to try as a statement list. // Stop and return on any other error. - if !strings.Contains(err.String(), "expected declaration") { + if !strings.Contains(err.Error(), "expected declaration") { return nil, nil, err } |