diff --git a/src/cmd/compile/internal/gc/parser.go b/src/cmd/compile/internal/gc/parser.go index fbc5a5e1eb83c8..61656845744b89 100644 --- a/src/cmd/compile/internal/gc/parser.go +++ b/src/cmd/compile/internal/gc/parser.go @@ -280,13 +280,11 @@ func (p *parser) package_() { defer p.trace("package_")() } - if p.got(LPACKAGE) { - mkpackage(p.sym().Name) - } else { - prevlineno = lineno // see issue #13267 + if !p.got(LPACKAGE) { p.syntax_error("package statement must be first") errorexit() } + mkpackage(p.sym().Name) } // ImportDecl = "import" ( ImportSpec | "(" { ImportSpec ";" } ")" ) .