diff --git a/types/dnstype/dnstype.go b/types/dnstype/dnstype.go index 9a3db4744..2c1037c39 100644 --- a/types/dnstype/dnstype.go +++ b/types/dnstype/dnstype.go @@ -5,7 +5,7 @@ // Package dnstype defines types for working with DNS. package dnstype -//go:generate go run tailscale.com/cmd/cloner --type=Resolver --clonefunc=true +//go:generate go run tailscale.com/cmd/viewer --type=Resolver --clonefunc=true import ( "net/netip" diff --git a/types/dnstype/dnstype_view.go b/types/dnstype/dnstype_view.go index 7a68f6381..7f99be2f4 100644 --- a/types/dnstype/dnstype_view.go +++ b/types/dnstype/dnstype_view.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// Code generated by tailscale.com/util/codegen (viewer); DO NOT EDIT. +// Code generated by tailscale/cmd/viewer; DO NOT EDIT. package dnstype @@ -15,14 +15,18 @@ ) //go:generate go run tailscale.com/cmd/cloner -clonefunc=true -type=Resolver + // View returns a readonly view of Resolver. func (p *Resolver) View() ResolverView { return ResolverView{ж: p} } -// ResolverView provides a read-only view on Resolver. -// It's methods should only be called if `Valid()` returns true. +// ResolverView provides a read-only view over Resolver. +// +// Its methods should only be called if `Valid()` returns true. type ResolverView struct { + // ж is the underlying mutable value, named with a hard-to-type + // character that looks pointy like a pointer. // It is named distinctively to make you think of how dangerous it is to escape // to callers. You must not let callers be able to mutate it. ж *Resolver @@ -34,7 +38,7 @@ func (v ResolverView) Valid() bool { return v.ж != nil } // AsStruct returns a clone of the underlying value which aliases no memory with // the original. func (v ResolverView) AsStruct() *Resolver { - if v.ж != nil { + if v.ж == nil { return nil } return v.ж.Clone()