all: apply godoc [Name] link conventions across comments
Every Go-identifier reference in // and /* */ comments now uses
godoc's [Name] linking syntax so pkg.go.dev and `go doc` render
them as clickable cross-references. No behaviour change.
Pattern applied across the tree:
In-package [Foo], [Foo.Bar]
Cross-package [pkg.Foo], [pkg.Foo.Bar]
Stdlib [netip.Prefix], [errors.Is], [context.Context]
Tailscale [tailcfg.MapResponse], [tailcfg.Node.CapMap],
[tailcfg.NodeAttrSuggestExitNode]
Skip rules:
- File:line refs left as plain text
- HuJSON wire keys inside backtick raw strings untouched
- ACL/policy syntax tokens (tag:foo, autogroup:self, ...) not Go
symbols, left as plain text
- JSON/OIDC wire keys, gorm tags, RFC IPv6 placeholders, markdown
link tags, decorative dividers — all left as-is
This commit is contained in:
parent
17236fd284
commit
4cca63155d
124 changed files with 1037 additions and 1011 deletions
|
|
@ -2,20 +2,20 @@ package types
|
|||
|
||||
import "net/netip"
|
||||
|
||||
// The named slice types below are used for GORM-persisted Node columns
|
||||
// The named slice types below are used for GORM-persisted [Node] columns
|
||||
// that serialise as JSON. GORM v2's struct-based Updates skips fields
|
||||
// it considers zero — for unnamed slice types that is nil — and the
|
||||
// default reflect.Value.IsZero treats a nil slice as zero. By giving
|
||||
// default [reflect.Value.IsZero] treats a nil slice as zero. By giving
|
||||
// each slice an IsZero() that always returns false, the column is
|
||||
// always included in UPDATE statements regardless of whether the
|
||||
// caller is clearing the field. JSON marshalling is unchanged: a nil
|
||||
// value serialises to null and an empty value serialises to [].
|
||||
//
|
||||
// The .List() helpers return the underlying unnamed slice for the
|
||||
// places (mainly testify assertions over reflect.DeepEqual) where the
|
||||
// places (mainly testify assertions over [reflect.DeepEqual]) where the
|
||||
// distinction between the named and unnamed type matters.
|
||||
|
||||
// Strings is a []string with a GORM-friendly IsZero.
|
||||
// Strings is a []string with a GORM-friendly [Strings.IsZero].
|
||||
type Strings []string
|
||||
|
||||
// IsZero implements GORM's zeroer interface to keep the column in the
|
||||
|
|
@ -25,7 +25,7 @@ func (Strings) IsZero() bool { return false }
|
|||
// List returns the underlying []string.
|
||||
func (s Strings) List() []string { return []string(s) }
|
||||
|
||||
// Prefixes is a []netip.Prefix with a GORM-friendly IsZero.
|
||||
// Prefixes is a []netip.Prefix with a GORM-friendly [Prefixes.IsZero].
|
||||
type Prefixes []netip.Prefix
|
||||
|
||||
// IsZero implements GORM's zeroer interface to keep the column in the
|
||||
|
|
@ -35,7 +35,7 @@ func (Prefixes) IsZero() bool { return false }
|
|||
// List returns the underlying []netip.Prefix.
|
||||
func (s Prefixes) List() []netip.Prefix { return []netip.Prefix(s) }
|
||||
|
||||
// AddrPorts is a []netip.AddrPort with a GORM-friendly IsZero.
|
||||
// AddrPorts is a []netip.AddrPort with a GORM-friendly [AddrPorts.IsZero].
|
||||
type AddrPorts []netip.AddrPort
|
||||
|
||||
// IsZero implements GORM's zeroer interface to keep the column in the
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue