1
0
mirror of https://github.com/StackExchange/dnscontrol.git synced 2024-05-11 05:55:12 +00:00

NEW FEATURE: diff2: A better "diff" mechanism (#1852)

This commit is contained in:
Tom Limoncelli
2022-12-11 17:28:58 -05:00
committed by GitHub
parent b0f2945510
commit 54fc2e9ce3
40 changed files with 2581 additions and 81 deletions

View File

@ -26,6 +26,8 @@ func (z *ZoneGenData) Less(i, j int) bool {
a, b := z.Records[i], z.Records[j]
// Sort by name.
// If we are at the apex, use "@" in the sorting.
compA, compB := a.NameFQDN, b.NameFQDN
if compA != compB {
if a.Name == "@" {
@ -34,7 +36,7 @@ func (z *ZoneGenData) Less(i, j int) bool {
if b.Name == "@" {
compB = "@"
}
return zoneLabelLess(compA, compB)
return LabelLess(compA, compB)
}
// sub-sort by type
@ -103,7 +105,7 @@ func (z *ZoneGenData) Less(i, j int) bool {
return a.String() < b.String()
}
func zoneLabelLess(a, b string) bool {
func LabelLess(a, b string) bool {
// Compare two zone labels for the purpose of sorting the RRs in a Zone.
// If they are equal, we are done. All other code is simplified