mirror of
https://github.com/StackExchange/dnscontrol.git
synced 2024-05-11 05:55:12 +00:00
CHORE: More cleanups (#2632)
This commit is contained in:
@@ -13,7 +13,7 @@ import (
|
||||
// It is for backwards compatibility only. New providers should use pkg/diff2.
|
||||
//
|
||||
// To use this simply change New() to NewCompat(). If that doesn't
|
||||
// work please report a bug. The extraValues feature is not supported.
|
||||
// work please report a bug. The extraValues parameter is not supported.
|
||||
func NewCompat(dc *models.DomainConfig, extraValues ...func(*models.RecordConfig) map[string]string) Differ {
|
||||
if len(extraValues) != 0 {
|
||||
panic("extraValues not supported")
|
||||
|
@@ -215,6 +215,7 @@ func mkCompareBlobs(rc *models.RecordConfig, f func(*models.RecordConfig) string
|
||||
}
|
||||
}
|
||||
|
||||
// We do this to save memory. This assures the first return value uses the same memory as the second.
|
||||
lenWithoutTTL := len(comp)
|
||||
compFull := comp + fmt.Sprintf(" ttl=%d", rc.TTL)
|
||||
|
||||
|
@@ -324,7 +324,7 @@ func TestCheckDuplicates(t *testing.T) {
|
||||
}
|
||||
errs := checkDuplicates(records)
|
||||
if len(errs) != 0 {
|
||||
t.Errorf("Expect duplicate NOT found but found %q", errs)
|
||||
t.Errorf("Expected duplicate NOT found but found %q", errs)
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -9,6 +9,16 @@ import (
|
||||
|
||||
// Keep these in alphabetical order.
|
||||
|
||||
// TxtHasBackslash audits TXT records for strings that contains one or more backslashes.
|
||||
func TxtHasBackslash(rc *models.RecordConfig) error {
|
||||
for _, txt := range rc.TxtStrings {
|
||||
if strings.Contains(txt, `\`) {
|
||||
return fmt.Errorf("txtstring contains backslash")
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// TxtHasBackticks audits TXT records for strings that contain backticks.
|
||||
func TxtHasBackticks(rc *models.RecordConfig) error {
|
||||
for _, txt := range rc.TxtStrings {
|
||||
|
Reference in New Issue
Block a user