cmd/go: modules vendoring themselves can cause panics with type assertions #31681
Labels
FrozenDueToAge
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
You need to create 2 modules, say
m0
andm1
m0 contains 2 submodules, say
a
andb
m1 contains a main function to run the code
m0/a/a.go:
m0/b/b.go:
m1/main.go
The run
go run main.go
What did you expect to see?
Type assertion should've happened with no issue.
What did you see instead?
The following confusing panic:
This is just a case I was able to use to easily recreate the issue. I ran into this because I was using an external library that for some reason vendors itself (i've created an issue over there as well). I'm not sure why someone would vendor the package in that way, regardless the error I got from it was confusing (i.e the panic message saying
interface{} is T, not T
).The text was updated successfully, but these errors were encountered: