]> Cypherpunks repositories - gostls13.git/commitdiff
go/printer: remove "written" result value - is never used
authorRobert Griesemer <gri@golang.org>
Tue, 22 Nov 2011 23:27:10 +0000 (15:27 -0800)
committerRobert Griesemer <gri@golang.org>
Tue, 22 Nov 2011 23:27:10 +0000 (15:27 -0800)
R=r
CC=golang-dev
https://golang.org/cl/5436052

src/cmd/gofix/main.go
src/cmd/gofmt/gofmt.go
src/pkg/go/printer/performance_test.go
src/pkg/go/printer/printer.go
src/pkg/go/printer/printer_test.go

index a1509b9262dbfa245bf1638ac5b1779654fd177d..c8096b3976892d705e01df87e8238b3493f36964 100644 (file)
@@ -109,7 +109,7 @@ func gofmtFile(f *ast.File) ([]byte, error) {
        var buf bytes.Buffer
 
        ast.SortImports(fset, f)
-       _, err := printConfig.Fprint(&buf, fset, f)
+       err := printConfig.Fprint(&buf, fset, f)
        if err != nil {
                return nil, err
        }
@@ -203,7 +203,7 @@ var gofmtBuf bytes.Buffer
 
 func gofmt(n interface{}) string {
        gofmtBuf.Reset()
-       _, err := printConfig.Fprint(&gofmtBuf, fset, n)
+       err := printConfig.Fprint(&gofmtBuf, fset, n)
        if err != nil {
                return "<" + err.Error() + ">"
        }
index 9562d7965cccf4f6418641e78667712b340c8d64..2c52250c2ed11474a80b6f6125c1ab49aff72dd8 100644 (file)
@@ -121,7 +121,7 @@ func processFile(filename string, in io.Reader, out io.Writer, stdin bool) error
        }
 
        var buf bytes.Buffer
-       _, err = (&printer.Config{printerMode, *tabWidth}).Fprint(&buf, fset, file)
+       err = (&printer.Config{printerMode, *tabWidth}).Fprint(&buf, fset, file)
        if err != nil {
                return err
        }
index 84fb2808ebaab734a9a803e418052095f3cf803c..dbd942292b537c83ccd3a7b7b9f6384fda5c1f2c 100644 (file)
@@ -20,7 +20,7 @@ import (
 var testfile *ast.File
 
 func testprint(out io.Writer, file *ast.File) {
-       if _, err := (&Config{TabIndent | UseSpaces, 8}).Fprint(out, fset, file); err != nil {
+       if err := (&Config{TabIndent | UseSpaces, 8}).Fprint(out, fset, file); err != nil {
                log.Fatalf("print error: %s", err)
        }
 }
index bf5f7bf8c5c121cdc4691ad109aa2de59c2ea454..676d1bcc091788fc9fd69fa7ef6b7d610028b61b 100644 (file)
@@ -1000,21 +1000,18 @@ func (cfg *Config) fprint(output io.Writer, fset *token.FileSet, node interface{
        return
 }
 
-// Fprint "pretty-prints" an AST node to output and returns the number
-// of bytes written and an error (if any) for a given configuration cfg.
+// Fprint "pretty-prints" an AST node to output for a given configuration cfg.
 // Position information is interpreted relative to the file set fset.
 // The node type must be *ast.File, or assignment-compatible to ast.Expr,
 // ast.Decl, ast.Spec, or ast.Stmt.
-// Note: The number of bytes written is always 0 and should be ignored.
 //
-func (cfg *Config) Fprint(output io.Writer, fset *token.FileSet, node interface{}) (int, error) {
-       return 0, cfg.fprint(output, fset, node, make(map[ast.Node]int))
+func (cfg *Config) Fprint(output io.Writer, fset *token.FileSet, node interface{}) error {
+       return cfg.fprint(output, fset, node, make(map[ast.Node]int))
 }
 
 // Fprint "pretty-prints" an AST node to output.
 // It calls Config.Fprint with default settings.
 //
 func Fprint(output io.Writer, fset *token.FileSet, node interface{}) error {
-       _, err := (&Config{Tabwidth: 8}).Fprint(output, fset, node)
-       return err
+       return (&Config{Tabwidth: 8}).Fprint(output, fset, node)
 }
index a644aa383ab9df1006d188709af31d12c6b74ba8..924d4dfdb2901a769901791be091aa9de579c58b 100644 (file)
@@ -62,7 +62,7 @@ func runcheck(t *testing.T, source, golden string, mode checkMode) {
 
        // format source
        var buf bytes.Buffer
-       if _, err := cfg.Fprint(&buf, fset, prog); err != nil {
+       if err := cfg.Fprint(&buf, fset, prog); err != nil {
                t.Error(err)
        }
        res := buf.Bytes()