mirror of https://github.com/golang/go.git
cmd/gc: make missing package error fatal
No longer continue assuming package main. Fixes #4776. R=golang-dev, r CC=golang-dev https://golang.org/cl/12677043
This commit is contained in:
parent
f2bc275525
commit
66e8471391
|
|
@ -136,8 +136,7 @@ package:
|
|||
{
|
||||
prevlineno = lineno;
|
||||
yyerror("package statement must be first");
|
||||
flusherrors();
|
||||
mkpackage("main");
|
||||
errorexit();
|
||||
}
|
||||
| LPACKAGE sym ';'
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2428,8 +2428,7 @@ yyreduce:
|
|||
{
|
||||
prevlineno = lineno;
|
||||
yyerror("package statement must be first");
|
||||
flusherrors();
|
||||
mkpackage("main");
|
||||
errorexit();
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,10 @@
|
|||
// errorcheck
|
||||
|
||||
// Copyright 2013 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// Issue 4776: missing package declaration error should be fatal.
|
||||
|
||||
type MyInt int32 // ERROR "package statement must be first"
|
||||
|
||||
Loading…
Reference in New Issue