]> Cypherpunks repositories - gostls13.git/commitdiff
go/parser: package name must not be the blank identifier
authorRobert Griesemer <gri@golang.org>
Sat, 2 Apr 2011 03:51:55 +0000 (20:51 -0700)
committerRobert Griesemer <gri@golang.org>
Sat, 2 Apr 2011 03:51:55 +0000 (20:51 -0700)
R=r, r2, rsc1
CC=golang-dev
https://golang.org/cl/4343045

src/pkg/go/parser/parser.go

index fd9ad0f1b529785cc0638ea7c9be33603d3e028c..84a0da6ae7bddd6693e93bcb6464d2bd38d966c5 100644 (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