Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
GitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
cmd/link: Unused interface methods don't get gc'd #42421
Follow up to #38685 that seems to have solved a simple case but does not eliminate an unused interface method across packages
What version of Go are you using (
Thanks. Interesting example.
I think the unused method is linked in because it is referenced from the itab.
If you change foo.go to do
then UnusedInterfaceMethod disappears.
I agree this is awkward, and we probably could fix the itab case. But it's too late for 1.16. Will try in 1.17. Thanks.
I'm surprised there is any case in which an exported method is eliminated from a compiled binary. Reflection can reach it without ever naming it: https://play.golang.org/p/zCIdBYzv8zo. I think that's the reason the