style/naming

This commit is contained in:
Mikhail Rozentsvayg 2025-03-19 12:01:43 -07:00
parent 2e29a19ab7
commit 47236fd8bf
2 changed files with 5 additions and 5 deletions

View File

@ -648,7 +648,7 @@ func (p *CloudFlareProvider) newCloudFlareChange(action string, endpoint *endpoi
} }
} }
func getDNSRecordIndex(r cloudflare.DNSRecord) DNSRecordIndex { func NewDNSRecordIndex(r cloudflare.DNSRecord) DNSRecordIndex {
return DNSRecordIndex{Name: r.Name, Type: r.Type, Content: r.Content} return DNSRecordIndex{Name: r.Name, Type: r.Type, Content: r.Content}
} }
@ -672,7 +672,7 @@ func (p *CloudFlareProvider) listDNSRecordsWithAutoPagination(ctx context.Contex
} }
for _, r := range pageRecords { for _, r := range pageRecords {
records[getDNSRecordIndex(r)] = r records[NewDNSRecordIndex(r)] = r
} }
params.ResultInfo = resultInfo.Next() params.ResultInfo = resultInfo.Next()
if params.ResultInfo.Done() { if params.ResultInfo.Done() {
@ -682,7 +682,7 @@ func (p *CloudFlareProvider) listDNSRecordsWithAutoPagination(ctx context.Contex
return records, nil return records, nil
} }
func getCustomHostnameIndex(ch cloudflare.CustomHostname) CustomHostnameIndex { func NewCustomHostnameIndex(ch cloudflare.CustomHostname) CustomHostnameIndex {
return CustomHostnameIndex{Hostname: ch.Hostname} return CustomHostnameIndex{Hostname: ch.Hostname}
} }
@ -707,7 +707,7 @@ func (p *CloudFlareProvider) listCustomHostnamesWithPagination(ctx context.Conte
return nil, err return nil, err
} }
for _, ch := range pageCustomHostnameListResponse { for _, ch := range pageCustomHostnameListResponse {
chs[getCustomHostnameIndex(ch)] = ch chs[NewCustomHostnameIndex(ch)] = ch
} }
resultInfo = result.Next() resultInfo = result.Next()
if resultInfo.Done() { if resultInfo.Done() {

View File

@ -1312,7 +1312,7 @@ func TestCloudflareGroupByNameAndType(t *testing.T) {
for _, tc := range testCases { for _, tc := range testCases {
records := make(DNSRecordsMap) records := make(DNSRecordsMap)
for _, r := range tc.Records { for _, r := range tc.Records {
records[getDNSRecordIndex(r)] = r records[NewDNSRecordIndex(r)] = r
} }
endpoints := groupByNameAndTypeWithCustomHostnames(records, CustomHostnamesMap{}) endpoints := groupByNameAndTypeWithCustomHostnames(records, CustomHostnamesMap{})
// Targets order could be random with underlying map // Targets order could be random with underlying map