Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(525)

Unified Diff: src/cmd/gofmt/gofmt.go

Issue 3050041: code review 3050041: go/ast: use token.Pos instead of token.Position; adjus... (Closed)
Patch Set: code review 3050041: go/ast: use token.Pos instead of token.Position; adjus... Created 14 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/cmd/godoc/spec.go ('k') | src/cmd/gofmt/rewrite.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/cmd/gofmt/gofmt.go
===================================================================
--- a/src/cmd/gofmt/gofmt.go
+++ b/src/cmd/gofmt/gofmt.go
@@ -12,6 +12,7 @@
"go/parser"
"go/printer"
"go/scanner"
+ "go/token"
"io/ioutil"
"os"
pathutil "path"
@@ -39,6 +40,7 @@
var (
+ fset = token.NewFileSet()
exitCode = 0
rewrite func(*ast.File) *ast.File
parserMode uint
@@ -93,7 +95,7 @@
return err
}
- file, err := parser.ParseFile(f.Name(), src, parserMode)
+ file, err := parser.ParseFile(fset, f.Name(), src, parserMode)
if err != nil {
return err
@@ -112,7 +114,7 @@
}
var res bytes.Buffer
- _, err = (&printer.Config{printerMode, *tabWidth, nil}).Fprint(&res, file)
+ _, err = (&printer.Config{printerMode, *tabWidth, nil}).Fprint(&res, fset, file)
if err != nil {
return err
}
« no previous file with comments | « src/cmd/godoc/spec.go ('k') | src/cmd/gofmt/rewrite.go » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b