Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
cmd/compile: duplicate anonymous interface declarations cause non-determinism #30202
What version of Go are you using (
@Gnouc I'm not sure entirely what you are asking.
Are you talking about the runtime
That table is a hash table. The general rule is that two equal keys must map to the same bucket. Different keys should map to different buckets, but they don't have to. Different keys mapping to the same bucket make the code slower, but not wrong.
So ideally two otherwise identical anonymous interfaces in different packages should map to different buckets, but they don't have to. Looking at the code, it seems like they would map to the same bucket, as we use a hash of the string representation of the interface type. Not ideal, but this case probably doesn't happen often enough to warrant doing anything about it.
Bisecting #31975, which is a duplicate of this issue, yielded https://go-review.googlesource.com/106796, which was the introduction of the indexed export format. Not a surprise, in retrospect, but good to confirm.
Of note: https://go-review.googlesource.com/c/go/+/170037 added anonymous interfaces to the standard library (