mirror of
https://github.com/StackExchange/dnscontrol.git
synced 2024-05-11 05:55:12 +00:00
Sort updates (cosmetic) (#772)
* Sort updates (cosmetic) * comments * More comments
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"sort"
|
||||
|
||||
"github.com/StackExchange/dnscontrol/v3/models"
|
||||
"github.com/StackExchange/dnscontrol/v3/pkg/diff"
|
||||
@@ -215,5 +216,13 @@ func (c *api) GenerateDomainCorrections(dc *models.DomainConfig, existing models
|
||||
},
|
||||
})
|
||||
|
||||
// NB(tlim): This sort is just to make updates look pretty. It is
|
||||
// cosmetic. The risk here is that there may be some updates that
|
||||
// require a specific order (for example a delete before an add).
|
||||
// However the code doesn't seem to have such situation. All tests
|
||||
// pass. That said, if this breaks anything, the easiest fix might
|
||||
// be to just remove the sort.
|
||||
sort.Slice(corrections, func(i, j int) bool { return diff.CorrectionLess(corrections, i, j) })
|
||||
|
||||
return corrections, nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user