fix: linter

This commit is contained in:
Pascal Bachor 2025-07-29 14:46:30 +02:00
parent 2333e93f1e
commit 80058873e4
3 changed files with 7 additions and 8 deletions

View File

@ -87,13 +87,13 @@ func (changes *Changes) MarshalJSON() ([]byte, error) {
}) })
} }
func MkUpdates(old []*endpoint.Endpoint, new []*endpoint.Endpoint) ([]*Update, error) { func MkUpdates(olds []*endpoint.Endpoint, news []*endpoint.Endpoint) ([]*Update, error) {
updates := []*Update{} updates := []*Update{}
if nOld, nNew := len(old), len(new); nOld != nNew { if nOld, nNew := len(olds), len(news); nOld != nNew {
return nil, fmt.Errorf("Number of old updates (%v) does not match number of new updates (%v)", nOld, nNew) return nil, fmt.Errorf("number of old updates (%v) does not match number of new updates (%v)", nOld, nNew)
} }
for i, old := range old { for i, old := range olds {
updates = append(updates, &Update{Old: old, New: new[i]}) updates = append(updates, &Update{Old: old, New: news[i]})
} }
return updates, nil return updates, nil
} }

View File

@ -304,7 +304,6 @@ func (f *zoneFilter) EndpointZoneID(endpoint *endpoint.Endpoint, zones map[strin
func merge(updates []*plan.Update) []*endpoint.Endpoint { func merge(updates []*plan.Update) []*endpoint.Endpoint {
var result []*endpoint.Endpoint var result []*endpoint.Endpoint
for _, update := range updates { for _, update := range updates {
if !update.New.Targets.Same(update.Old.Targets) { if !update.New.Targets.Same(update.Old.Targets) {
// new target: always update, TTL will be overwritten too if necessary // new target: always update, TTL will be overwritten too if necessary
result = append(result, update.New) result = append(result, update.New)

View File

@ -284,8 +284,8 @@ func (im *TXTRegistry) ApplyChanges(ctx context.Context, changes *plan.Changes)
// when we update old TXT records for which value has changed (due to new label) this would still work because // when we update old TXT records for which value has changed (due to new label) this would still work because
// !!! TXT record value is uniquely generated from the Labels of the endpoint. Hence old TXT record can be uniquely reconstructed // !!! TXT record value is uniquely generated from the Labels of the endpoint. Hence old TXT record can be uniquely reconstructed
// NOTE: Whether `generateTXTRecord` returns `nil` depends only on DNSName, which will be the same for `old` and `new` // NOTE: Whether `generateTXTRecord` returns `nil` depends only on DNSName, which will be the same for `old` and `new`
if old, new := im.generateTXTRecord(r.Old), im.generateTXTRecord(r.New); old != nil && new != nil { if old, new_ := im.generateTXTRecord(r.Old), im.generateTXTRecord(r.New); old != nil && new_ != nil {
filteredChanges.Update = append(filteredChanges.Update, &plan.Update{Old: old, New: new}) filteredChanges.Update = append(filteredChanges.Update, &plan.Update{Old: old, New: new_})
} }
if im.cacheInterval > 0 { if im.cacheInterval > 0 {
// remove old version of record from cache // remove old version of record from cache