mirror of
https://github.com/golang/go
synced 2024-11-11 22:40:22 -07:00
cmd/gc: fix error message for import as 'init'
Fixes #5853. R=ken2 CC=golang-dev https://golang.org/cl/11104044
This commit is contained in:
parent
5930649306
commit
1d4ed0c86b
@ -197,6 +197,10 @@ import_stmt:
|
||||
importdot(ipkg, pack);
|
||||
break;
|
||||
}
|
||||
if(strcmp(my->name, "init") == 0) {
|
||||
yyerror("cannot import package as init - init must be a func");
|
||||
break;
|
||||
}
|
||||
if(my->name[0] == '_' && my->name[1] == '\0')
|
||||
break;
|
||||
if(my->def) {
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -146,7 +146,7 @@
|
||||
|
||||
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
|
||||
typedef union YYSTYPE
|
||||
#line 28 "go.y"
|
||||
#line 30 "go.y"
|
||||
{
|
||||
Node* node;
|
||||
NodeList* list;
|
||||
|
9
test/fixedbugs/issue4517d.go
Normal file
9
test/fixedbugs/issue4517d.go
Normal file
@ -0,0 +1,9 @@
|
||||
// errorcheck
|
||||
|
||||
// Copyright 2012 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.
|
||||
|
||||
package p
|
||||
|
||||
import init "fmt" // ERROR "cannot import package as init - init must be a func"
|
Loading…
Reference in New Issue
Block a user