Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
golang
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
golang
Commits
1d4ed0c8
Commit
1d4ed0c8
authored
Jul 12, 2013
by
Russ Cox
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cmd/gc: fix error message for import as 'init'
Fixes #5853. R=ken2 CC=golang-dev
https://golang.org/cl/11104044
parent
59306493
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
14 additions
and
1 deletion
+14
-1
go.y
src/cmd/gc/go.y
+4
-0
y.tab.c
src/cmd/gc/y.tab.c
+0
-0
y.tab.h
src/cmd/gc/y.tab.h
+1
-1
issue4517d.go
test/fixedbugs/issue4517d.go
+9
-0
No files found.
src/cmd/gc/go.y
View file @
1d4ed0c8
...
...
@@ -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) {
...
...
src/cmd/gc/y.tab.c
View file @
1d4ed0c8
This diff is collapsed.
Click to expand it.
src/cmd/gc/y.tab.h
View file @
1d4ed0c8
...
...
@@ -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
;
...
...
test/fixedbugs/issue4517d.go
0 → 100644
View file @
1d4ed0c8
// 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"
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment