From: Robert Griesemer Date: Sat, 2 Apr 2011 03:51:55 +0000 (-0700) Subject: go/parser: package name must not be the blank identifier X-Git-Tag: weekly.2011-04-04~23 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=c42b3e21c30c354a5a2fdc840a0824fb71c10368;p=gostls13.git go/parser: package name must not be the blank identifier R=r, r2, rsc1 CC=golang-dev https://golang.org/cl/4343045 --- diff --git a/src/pkg/go/parser/parser.go b/src/pkg/go/parser/parser.go index fd9ad0f1b5..84a0da6ae7 100644 --- a/src/pkg/go/parser/parser.go +++ b/src/pkg/go/parser/parser.go @@ -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