]> Cypherpunks repositories - gostls13.git/commitdiff
go/parser: don't report name errors if DeclarationErrors is not set
authorRobert Griesemer <gri@golang.org>
Mon, 29 Jul 2013 23:00:28 +0000 (16:00 -0700)
committerRobert Griesemer <gri@golang.org>
Mon, 29 Jul 2013 23:00:28 +0000 (16:00 -0700)
R=adonovan
CC=golang-dev
https://golang.org/cl/12072043

src/pkg/go/parser/parser.go

index a0ac8d7131757efaa7c444c5782ad20b5572220c..c3245e375d4137c671e347b71a7092d448684eb8 100644 (file)
@@ -2385,7 +2385,7 @@ 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 == "_" {
+       if ident.Name == "_" && p.mode&DeclarationErrors != 0 {
                p.error(p.pos, "invalid package name _")
        }
        p.expectSemi()