1
0
mirror of https://github.com/golang/go synced 2024-11-21 20:04:44 -07:00

go/parser: package name must not be the blank identifier

R=r, r2, rsc1
CC=golang-dev
https://golang.org/cl/4343045
This commit is contained in:
Robert Griesemer 2011-04-01 20:51:55 -07:00
parent 7b40095e8c
commit c42b3e21c3

View File

@ -2209,6 +2209,9 @@ func (p *parser) parseFile() *ast.File {
// Go spec: The package clause is not a declaration;
// the package name does not appear in any scope.
ident := p.parseIdent()
if ident.Name == "_" {
p.error(p.pos, "invalid package name _")
}
p.expectSemi()
var decls []ast.Decl