go.tools/cmd/vet: use directory for pkg.path if path is "."

Before:
        math/big/nat_test.go:688: arg r for printf verb %s of wrong type: ..Word
After:
        math/big/nat_test.go:688: arg r for printf verb %s of wrong type: big.Word

R=gri
CC=golang-dev
https://golang.org/cl/10400044
This commit is contained in:
Rob Pike 2013-06-18 14:02:01 -07:00
parent df787c2073
commit ce82fb0e23
1 changed files with 4 additions and 0 deletions

View File

@ -220,6 +220,10 @@ func doPackage(directory string, names []string) {
files = append(files, &File{fset: fs, content: data, name: name, file: parsedFile}) files = append(files, &File{fset: fs, content: data, name: name, file: parsedFile})
} }
pkg := new(Package) pkg := new(Package)
if directory == "." {
// Special case: Use the base name so we don't see "." as the package name in messages.
directory = filepath.Base(filepath.Dir(names[0]))
}
pkg.path = directory pkg.path = directory
pkg.files = files pkg.files = files
// Type check the package. // Type check the package.