I noticed cmd/{cloner,viewer} didn't support structs with embedded
fields while working on a change in another repo. This adds support.
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
pull/8108/head
Brad Fitzpatrick2 years agocommitted byBrad Fitzpatrick
//go:generate go run tailscale.com/cmd/viewer --type=StructWithPtrs,StructWithoutPtrs,Map,StructWithSlices,OnlyGetClone --clone-only-type=OnlyGetClone
//go:generate go run tailscale.com/cmd/viewer --type=StructWithPtrs,StructWithoutPtrs,Map,StructWithSlices,OnlyGetClone,StructWithEmbedded --clone-only-type=OnlyGetClone
//go:generate go run tailscale.com/cmd/cloner -clonefunc=false -type=StructWithPtrs,StructWithoutPtrs,Map,StructWithSlices,OnlyGetClone
//go:generate go run tailscale.com/cmd/cloner -clonefunc=false -type=StructWithPtrs,StructWithoutPtrs,Map,StructWithSlices,OnlyGetClone,StructWithEmbedded
// View returns a readonly view of StructWithPtrs.
// View returns a readonly view of StructWithPtrs.
func(p*StructWithPtrs)View()StructWithPtrsView{
func(p*StructWithPtrs)View()StructWithPtrsView{
@ -325,3 +325,59 @@ var _StructWithSlicesViewNeedsRegeneration = StructWithSlices(struct {
Prefixes[]netip.Prefix
Prefixes[]netip.Prefix
Data[]byte
Data[]byte
}{})
}{})
// View returns a readonly view of StructWithEmbedded.