1
0
mirror of https://github.com/golang/go synced 2024-11-18 14:54:40 -07:00

go.tools/cmd/vet: set the package name unconditionally

A better fix than the one in CL 10400044

R=gri
CC=golang-dev
https://golang.org/cl/10376044
This commit is contained in:
Rob Pike 2013-06-18 14:12:51 -07:00
parent ce82fb0e23
commit 86c0ff156c

View File

@ -220,11 +220,7 @@ func doPackage(directory string, names []string) {
files = append(files, &File{fset: fs, content: data, name: name, file: parsedFile})
}
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 = astFiles[0].Name.Name
pkg.files = files
// Type check the package.
err := pkg.check(fs, astFiles)