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/util
Nick Khyl 03acab2639 cmd/cloner, cmd/viewer, util/codegen: add support for aliases of cloneable types
We have several checked type assertions to *types.Named in both cmd/cloner and cmd/viewer.
As Go 1.23 updates the go/types package to produce Alias type nodes for type aliases,
these type assertions no longer work as expected unless the new behavior is disabled
with gotypesalias=0.

In this PR, we add codegen.NamedTypeOf(t types.Type), which functions like t.(*types.Named)
but also unrolls type aliases. We then use it in place of type assertions in the cmd/cloner and
cmd/viewer packages where appropriate.

We also update type switches to include *types.Alias alongside *types.Named in relevant cases,
remove *types.Struct cases when switching on types.Type.Underlying and update the tests
with more cases where type aliases can be used.

Updates #13224
Updates #12912

Signed-off-by: Nick Khyl <nickk@tailscale.com>
3 months ago
..
cache
cibuild
clientmetric
cloudenv all: use math/rand/v2 more 5 months ago
cmpver
codegen cmd/cloner, cmd/viewer, util/codegen: add support for aliases of cloneable types 3 months ago
cstruct all: use Go 1.22 range-over-int 7 months ago
ctxkey
deephash util/deephash: fix test regression on 32-bit 5 months ago
dirwalk
dnsname all: use Go 1.22 range-over-int 7 months ago
execqueue
expvarx all: use Go 1.22 range-over-int 7 months ago
fastuuid all: use Go 1.22 range-over-int 7 months ago
goroutines
groupmember
hashx all: use Go 1.22 range-over-int 7 months ago
httphdr
httpm
jsonutil all: use Go 1.22 range-over-int 7 months ago
limiter all: add test for package comments, fix, add comments as needed 4 months ago
lineread
linuxfw util/linuxfw: return nil interface not concrete type 3 months ago
lru util/lru: add Clear method 6 months ago
mak
multierr all: use Go 1.22 range-over-int 7 months ago
must
nocasemaps all: use Go 1.22 range-over-int 7 months ago
osdiag all: add test for package comments, fix, add comments as needed 4 months ago
osshare all: add test for package comments, fix, add comments as needed 4 months ago
osuser util/osuser: turn wasm check into a const expression 3 months ago
pidowner all: use Go 1.22 range-over-int 7 months ago
pool util/pool: add package for storing and using a pool of items 6 months ago
precompress
progresstracking
quarantine
race all: use Go 1.22 range-over-int 7 months ago
racebuild
rands wgengine/magicsock: use math/rands/v2 5 months ago
reload all: use math/rand/v2 more 5 months ago
ringbuffer all: use Go 1.22 range-over-int 7 months ago
set util/set: add Of variant of SetOf that takes variadic parameter 6 months ago
singleflight util/singleflight: add DoChanContext 5 months ago
slicesx util/slicesx: add HasPrefix, HasSuffix, CutPrefix, and CutSuffix functions 4 months ago
syspolicy ipnlocal: support setting authkey at login using syspolicy (#13061) 3 months ago
sysresources
systemd
testenv
topk all: use Go 1.22 range-over-int 7 months ago
truncate
uniq all: use Go 1.22 range-over-int 7 months ago
vizerror
winutil util/winutil: add GetRegUserString/SetRegUserString accessors for storage and retrieval of string values in HKEY_CURRENT_USER 3 months ago
zstdframe all: use Go 1.22 range-over-int 7 months ago