aboutsummaryrefslogtreecommitdiff
path: root/test/codegen
diff options
context:
space:
mode:
authorJoe Tsai <joetsai@digital-static.net>2022-07-27 23:19:40 -0700
committerJoseph Tsai <joetsai@digital-static.net>2022-08-08 17:36:35 +0000
commitebf182c82de21858a1a167cc8d252ae85de806a7 (patch)
tree367d5fd30d8a38dfc15b47b837c57c821434a635 /test/codegen
parent84be09104883b6cf5d53e32f85834d5e71e954fa (diff)
downloadgo-ebf182c82de21858a1a167cc8d252ae85de806a7.tar.xz
reflect: avoid TypeOf in init
Calling TypeOf to initialize variables forces any import of "reflect" to link in the declared types of "reflect" even if they are unused. TypeOf operates on Type and which will pull in all transitive dependencies of Type, which includes Value as well. Avoid this problem by declaring a rtypeOf function that directly extracts the *rtype from an interface value without going through Type as an intermediate type. For a program that blank imports "reflect", this reduces the binary size by ~34 KiB. Updates #54097 Change-Id: I8dc7d8da8fedc48cc0dd842b69f510d17144827e Reviewed-on: https://go-review.googlesource.com/c/go/+/419757 Run-TryBot: Joseph Tsai <joetsai@digital-static.net> Reviewed-by: Bryan Mills <bcmills@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
Diffstat (limited to 'test/codegen')
0 files changed, 0 insertions, 0 deletions