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
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@griesemer
Copy link
Contributor

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 The path to resolution is known, but the work has not been done. 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

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 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 commented Feb 24, 2021

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

@golang golang locked and limited conversation to collaborators Feb 24, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

3 participants