From 48a504839dd132ebb5edab29bf5dcf8b4865b91f Mon Sep 17 00:00:00 2001 From: Paul Dee Date: Wed, 1 Mar 2023 16:17:07 +0100 Subject: [PATCH] Doc: Fixed a bit of havoc which appears in go docs (#2105) Co-authored-by: Tom Limoncelli --- models/quotes.go | 10 ++++++---- models/record.go | 35 +++++++++++++++++------------------ models/t_parse.go | 2 +- models/t_txt.go | 6 ++++-- 4 files changed, 28 insertions(+), 25 deletions(-) diff --git a/models/quotes.go b/models/quotes.go index 0f9f1cf8b..62c68d1ed 100644 --- a/models/quotes.go +++ b/models/quotes.go @@ -31,10 +31,12 @@ func StripQuotes(s string) string { } // ParseQuotedTxt returns the individual strings of a combined quoted string. -// `foo` -> []string{"foo"} -// `"foo"` -> []string{"foo"} -// `"foo" "bar"` -> []string{"foo", "bar"} -// `"f"oo" "bar"` -> []string{`f"oo`, "bar"} +// +// `foo` -> []string{"foo"} +// `"foo"` -> []string{"foo"} +// `"foo" "bar"` -> []string{"foo", "bar"} +// `"f"oo" "bar"` -> []string{`f"oo`, "bar"} +// // NOTE: It is assumed there is exactly one space between the quotes. // NOTE: This doesn't handle escaped quotes. // NOTE: You probably want to use ParseQuotedFields() for RFC 1035-compliant quoting. diff --git a/models/record.go b/models/record.go index 039b82a80..e84a932a7 100644 --- a/models/record.go +++ b/models/record.go @@ -52,33 +52,32 @@ import ( // // Name: // -// This is the shortname i.e. the NameFQDN without the origin suffix. -// It should never have a trailing "." -// It should never be null. The apex (naked domain) is stored as "@". -// If the origin is "foo.com." and Name is "foo.com", this means -// the intended FQDN is "foo.com.foo.com." (which may look odd) +// This is the shortname i.e. the NameFQDN without the origin suffix. It should +// never have a trailing "." It should never be null. The apex (naked domain) is +// stored as "@". If the origin is "foo.com." and Name is "foo.com", this means +// the intended FQDN is "foo.com.foo.com." (which may look odd) // // NameFQDN: // -// This is the FQDN version of Name. -// It should never have a trailing ".". -// NOTE: Eventually we will unexport Name/NameFQDN. Please start using -// the setters (SetLabel/SetLabelFromFQDN) and getters (GetLabel/GetLabelFQDN). -// as they will always work. +// This is the FQDN version of Name. It should never have a trailing ".". +// +// NOTE: Eventually we will unexport Name/NameFQDN. Please start using +// the setters (SetLabel/SetLabelFromFQDN) and getters (GetLabel/GetLabelFQDN). +// as they will always work. // // target: // -// This is the host or IP address of the record, with -// the other related parameters (weight, priority, etc.) stored in individual -// fields. -// NOTE: Eventually we will unexport Target. Please start using the -// setters (SetTarget*) and getters (GetTarget*) as they will always work. +// This is the host or IP address of the record, with the other related +// parameters (weight, priority, etc.) stored in individual fields. +// +// NOTE: Eventually we will unexport Target. Please start using the +// setters (SetTarget*) and getters (GetTarget*) as they will always work. // // SubDomain: // -// This is the subdomain path, if any, imported from the configuration. If -// present at the time of canonicalization it is inserted between the -// Name and origin when constructing a canonical (FQDN) target. +// This is the subdomain path, if any, imported from the configuration. If +// present at the time of canonicalization it is inserted between the +// Name and origin when constructing a canonical (FQDN) target. // // Idioms: // diff --git a/models/t_parse.go b/models/t_parse.go index 33347cb9e..73ea37d4c 100644 --- a/models/t_parse.go +++ b/models/t_parse.go @@ -17,7 +17,7 @@ import ( // // var err error // switch rType { -// case "MX": +// case "MX": // // MX priority in a separate field. // if err := rc.SetTargetMX(cr.Priority, target); err != nil { // return nil, fmt.Errorf("unparsable MX record received from cloudflare: %w", err) diff --git a/models/t_txt.go b/models/t_txt.go index 0554258de..9decea13d 100644 --- a/models/t_txt.go +++ b/models/t_txt.go @@ -154,8 +154,9 @@ func (rc *RecordConfig) GetTargetTXTJoined() string { // SetTargetTXTString is like SetTargetTXTs but accepts one big string, // which is parsed into individual strings. -// Ex: foo << 1 string +// Ex: // +// foo << 1 string // foo bar << 1 string // "foo bar" << 1 string // "foo" "bar" << 2 strings @@ -182,8 +183,9 @@ func (rc *RecordConfig) SetTargetTXTString(s string) error { // SetTargetTXTfromRFC1035Quoted parses a series of quoted strings // and sets .TxtStrings based on the result. // Note: Most APIs do notThis is rarely used. Try using SetTargetTXT() first. -// Ex: "foo" << 1 string +// Ex: // +// "foo" << 1 string // "foo bar" << 1 string // "foo" "bar" << 2 strings // foo << error. No quotes! Did you intend to use SetTargetTXT?