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
net/http/httptrace: uses reflect.Value.Call, forces linker's deadcode to be conservative #38505
net/http/httptrace uses reflect.Value.Call:
Its use anywhere in a program forces the linker's deadcode pass to go into its conservative mode when deciding whether to preserve otherwise-unused exported methods.
Because net/http depends on httptrace, any net/http program is potentially larger than it needs to be, even if the caller program doesn't use httptrace. That then makes binaries bigger (138 KiB larger in one program here)
(People who like this bug might also like #38450)
We should probably rewrite (or auto-generate?) httptrace to not use reflect.Value.Call.
I think this was fixed by https://go-review.googlesource.com/c/go/+/228792
But that might get reverted due to #38515, depending on how it gets fixed.
reflect.Value.Call, if reachable, used to bring all exported methods live. CL 228792 fixes this, removing the check of reflect.Value.Call. This CL adds a test. Updates #38505. Change-Id: Ib4cab3c3c86c9c9702d041266e59b159d0ff0a97 Reviewed-on: https://go-review.googlesource.com/c/go/+/228878 Reviewed-by: Brad Fitzpatrick <email@example.com>
Okay, we can close this now.
It's also not as bad as I originally thought: a program that imported
But with the latest toolchain changes (notably https://go-review.googlesource.com/c/go/+/228792), even using