-
Notifications
You must be signed in to change notification settings - Fork 10
Open
Labels
Description
Back in our Go 1.17 toolchain, we had support (ab6e4fe) for TS_LINK_FAIL_REFLECT
to make the linker explode if somebody used a IsReflectMethod
value anywhere in the program. (e.g. using reflect.Value which then bloats binaries conservatively because a bunch of deadcode can't happen just in case a text/template or something looks up a method by a string)
bradfitz@bradm4-2 go % git co tailscale.go1.18
git gbranch 'tailscale.go1.18' set up to track 'origin/tailscale.go1.18'.
Switched to a new branch 'tailscale.go1.18'
bradfitz@bradm4-2 go % git grep TS_LINK_FAIL_REFLECT
bradfitz@bradm4-2 go % git co tailscale.go1.17
branch 'tailscale.go1.17' set up to track 'origin/tailscale.go1.17'.
Switched to a new branch 'tailscale.go1.17'
bradfitz@bradm4-2 go % git grep TS_LINK_FAIL_REFLECT
src/cmd/link/internal/ld/deadcode.go: if v, _ := strconv.ParseBool(os.Getenv("TS_LINK_FAIL_REFLECT")); v {
src/cmd/link/internal/ld/deadcode.go: panic("unexpected reflect with TS_LINK_FAIL_REFLECT")
But we lost it in Go 1.18+
We should bring it back. We still set it in gocross.