summaryrefslogtreecommitdiffhomepage
path: root/control/controlhttp/controlhttpserver/controlhttpserver.go
diff options
context:
space:
mode:
authorNick Khyl <nickk@tailscale.com>2025-01-08 17:21:44 -0600
committerNick Khyl <1761190+nickkhyl@users.noreply.github.com>2025-01-14 09:37:10 -0600
commitda9965d51ca89a393bbf4c52818a579320dca93c (patch)
tree06dcda12aad905ed4ffefa6cd5e0064fde24be9c /control/controlhttp/controlhttpserver/controlhttpserver.go
parente4385f1c022dcce6809758c1bf0c06001a69c5dd (diff)
downloadtailscale-da9965d51ca89a393bbf4c52818a579320dca93c.tar.xz
tailscale-da9965d51ca89a393bbf4c52818a579320dca93c.zip
cmd/viewer,types/views,various: avoid allocations in pointer field getters whenever possible
In this PR, we add a generic views.ValuePointer type that can be used as a view for pointers to basic types and struct types that do not require deep cloning and do not have corresponding view types. Its Get/GetOk methods return stack-allocated shallow copies of the underlying value. We then update the cmd/viewer codegen to produce getters that return either concrete views when available or ValuePointer views when not, for pointer fields in generated view types. This allows us to avoid unnecessary allocations compared to returning pointers to newly allocated shallow copies. Updates #14570 Signed-off-by: Nick Khyl <nickk@tailscale.com>
Diffstat (limited to 'control/controlhttp/controlhttpserver/controlhttpserver.go')
0 files changed, 0 insertions, 0 deletions