Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

go/types, types2: type checker accepts import of package called "init" #43962

Closed
griesemer opened this issue Jan 28, 2021 · 3 comments
Closed

go/types, types2: type checker accepts import of package called "init" #43962

griesemer opened this issue Jan 28, 2021 · 3 comments
Assignees
Labels
Milestone

Comments

@griesemer
Copy link
Contributor

@griesemer griesemer commented Jan 28, 2021

Given two packages (for convenience represented via single files both stored in the same directory):

a.go: package init
b.go: package b; import "./a"

the compiler reports "cannot import package as init - init must be a func", but the go/types and types2 accept this (though they correctly don't accept a local rename to init).

cc: @findleyr

@griesemer griesemer added the NeedsFix label Jan 28, 2021
@griesemer griesemer added this to the Go1.17 milestone Jan 28, 2021
@griesemer griesemer self-assigned this Jan 28, 2021
@gopherbot
Copy link

@gopherbot gopherbot commented Jan 28, 2021

Change https://golang.org/cl/287494 mentions this issue: [dev.typeparams] cmd/compile/internal/types2: must not import a package called "init"

gopherbot pushed a commit that referenced this issue Jan 28, 2021
…ge called "init"

Updates #43962.

Change-Id: I070153c55baec62d13ca9284f02781b8c1276844
Reviewed-on: https://go-review.googlesource.com/c/go/+/287494
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
@findleyr
Copy link
Contributor

@findleyr findleyr commented Feb 9, 2021

The above CL was ported to dev.regabi in https://golang.org/cl/290570 (forgot to tag this issue). I think we can close this once dev.regabi becomes master.

@griesemer
Copy link
Contributor Author

@griesemer griesemer commented Feb 24, 2021

With the merge of dev.typeparams into master, this is now fixed.

@griesemer griesemer closed this Feb 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants