IMO tree-shaking and similar stuff must be not an afterthought, but instead built into language and tooling from the day one.
Doesn't seem far-fetched to ask for the compiler to warn on unused types/functions too.
So there are two choices here:
1. The Go compiler complains about code which is unused by the current main package.
2. The Go compiler tries to find/compile all main packages every-time.
Both of these options suck.Tree shaking shouldn't be necessary in 2024 anyway.
Even budget phones routinely have more than 4GB of RAM, and high-speed Internet access is the norm, so you can get away with a lot more inefficiency than just a few years ago.
Most have it on the standard tools, but I don't think any language was born with it.