You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tailscale/types
Josh Bleecher Snyder 4037fc25c5 types/wgkey: use value receiver with MarshalJSON
Pointer receivers used with MarshalJSON are code rakes.

https://github.com/golang/go/issues/22967
https://github.com/dominikh/go-tools/issues/911

I just stepped on one, and it hurt. Turn it over.
While we're here, optimize the code a bit.

name           old time/op    new time/op    delta
MarshalJSON-8     184ns ± 0%      44ns ± 0%  -76.03%  (p=0.000 n=20+19)

name           old alloc/op   new alloc/op   delta
MarshalJSON-8      184B ± 0%       80B ± 0%  -56.52%  (p=0.000 n=20+20)

name           old allocs/op  new allocs/op  delta
MarshalJSON-8      4.00 ± 0%      1.00 ± 0%  -75.00%  (p=0.000 n=20+20)

Signed-off-by: Josh Bleecher Snyder <josharian@gmail.com>
4 years ago
..
empty types/empty: add Message, stop using mysterious *struct{} 5 years ago
flagtype types/flagtype: fix bug showing the default port value (shown in --help) 4 years ago
ipproto net/packet, wgengine/filter: support SCTP 4 years ago
key wgengine/magicsock: stop depending on UpdateDst in legacy codepaths. 4 years ago
logger types/logger: fix rateFree interaction with verbosity prefixes 4 years ago
netmap types/netmap: remove some old TODOs 4 years ago
nettype wgengine/magicsock, tstest/natlab: start hooking up natlab to magicsock 4 years ago
opt types/opt: add Bool.EqualBool method 4 years ago
pad32 net/portmapper: add NAT-PMP client, move port mapping service probing 4 years ago
persist types/persist: split controlclient.Persist into a small leaf package 4 years ago
preftype types/preftype: don't use iota for consts persisted to disk 4 years ago
strbuilder types/strbuilder: add a variant of strings.Builder that uses sync.Pool 5 years ago
structs types/structs: add structs.Incomparable annotation, use it where applicable 5 years ago
wgkey types/wgkey: use value receiver with MarshalJSON 4 years ago