go.tools/gotype: fix build

Move from go.exp brought over an old version.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/9594043
This commit is contained in:
Robert Griesemer 2013-05-20 12:56:17 -07:00
parent 08cc526448
commit ad2dafcf8f
1 changed files with 7 additions and 7 deletions

View File

@ -143,10 +143,10 @@ func processDirectory(dirname string) {
for i, filename := range filenames { for i, filename := range filenames {
filenames[i] = filepath.Join(dirname, filename) filenames[i] = filepath.Join(dirname, filename)
} }
processFiles(filenames, false) processFiles(dirname, filenames, false)
} }
func processFiles(filenames []string, allFiles bool) { func processFiles(path string, filenames []string, allFiles bool) {
i := 0 i := 0
for _, filename := range filenames { for _, filename := range filenames {
switch info, err := os.Stat(filename); { switch info, err := os.Stat(filename); {
@ -164,10 +164,10 @@ func processFiles(filenames []string, allFiles bool) {
} }
} }
fset := token.NewFileSet() fset := token.NewFileSet()
processPackage(fset, parseFiles(fset, filenames[0:i])) processPackage(path, fset, parseFiles(fset, filenames[0:i]))
} }
func processPackage(fset *token.FileSet, files []*ast.File) { func processPackage(path string, fset *token.FileSet, files []*ast.File) {
type bailout struct{} type bailout struct{}
ctxt := types.Context{ ctxt := types.Context{
Error: func(err error) { Error: func(err error) {
@ -186,7 +186,7 @@ func processPackage(fset *token.FileSet, files []*ast.File) {
} }
}() }()
ctxt.Check(fset, files) ctxt.Check(path, fset, files...)
} }
func main() { func main() {
@ -195,9 +195,9 @@ func main() {
if flag.NArg() == 0 { if flag.NArg() == 0 {
fset := token.NewFileSet() fset := token.NewFileSet()
processPackage(fset, parseStdin(fset)) processPackage("<stdin>", fset, parseStdin(fset))
} else { } else {
processFiles(flag.Args(), true) processFiles("<files>", flag.Args(), true)
} }
if errorCount > 0 { if errorCount > 0 {