Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
golang
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
golang
Commits
4874d141
Commit
4874d141
authored
Nov 22, 2011
by
Robert Griesemer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
go/printer: remove "written" result value - is never used
R=r CC=golang-dev
https://golang.org/cl/5436052
parent
a0e54aaf
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
9 additions
and
12 deletions
+9
-12
main.go
src/cmd/gofix/main.go
+2
-2
gofmt.go
src/cmd/gofmt/gofmt.go
+1
-1
performance_test.go
src/pkg/go/printer/performance_test.go
+1
-1
printer.go
src/pkg/go/printer/printer.go
+4
-7
printer_test.go
src/pkg/go/printer/printer_test.go
+1
-1
No files found.
src/cmd/gofix/main.go
View file @
4874d141
...
...
@@ -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
()
+
">"
}
...
...
src/cmd/gofmt/gofmt.go
View file @
4874d141
...
...
@@ -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
}
...
...
src/pkg/go/printer/performance_test.go
View file @
4874d141
...
...
@@ -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
)
}
}
...
...
src/pkg/go/printer/printer.go
View file @
4874d141
...
...
@@ -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
)
}
src/pkg/go/printer/printer_test.go
View file @
4874d141
...
...
@@ -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
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment