diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index aed1b4e87..08c9af61e 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -33,7 +33,7 @@ jobs: uses: golangci/golangci-lint-action@v6 with: args: --timeout=30m - version: v1.60 + version: v1.63 # Run Spectral - name: Lint OpenAPI spec diff --git a/Makefile b/Makefile index 06e0557f3..b1403b16d 100644 --- a/Makefile +++ b/Makefile @@ -41,7 +41,7 @@ CONTROLLER_GEN=$(shell which controller-gen) endif golangci-lint: - @command -v golangci-lint > /dev/null || curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.60.3 + @command -v golangci-lint > /dev/null || curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.63.4 # Run the golangci-lint tool .PHONY: go-lint diff --git a/endpoint/domain_filter_test.go b/endpoint/domain_filter_test.go index 58f0e99d9..44f459c45 100644 --- a/endpoint/domain_filter_test.go +++ b/endpoint/domain_filter_test.go @@ -321,7 +321,7 @@ var domainFilterTests = []domainFilterTest{ var regexDomainFilterTests = []regexDomainFilterTest{ { - regexp.MustCompile("\\.org$"), + regexp.MustCompile(`\.org$`), regexp.MustCompile(""), []string{"foo.org", "bar.org", "foo.bar.org"}, true, @@ -330,7 +330,7 @@ var regexDomainFilterTests = []regexDomainFilterTest{ }, }, { - regexp.MustCompile("\\.bar\\.org$"), + regexp.MustCompile(`\.bar\.org$`), regexp.MustCompile(""), []string{"foo.org", "bar.org", "example.com"}, false, @@ -339,7 +339,7 @@ var regexDomainFilterTests = []regexDomainFilterTest{ }, }, { - regexp.MustCompile("(?:foo|bar)\\.org$"), + regexp.MustCompile(`(?:foo|bar)\.org$`), regexp.MustCompile(""), []string{"foo.org", "bar.org", "example.foo.org", "example.bar.org", "a.example.foo.org", "a.example.bar.org"}, true, @@ -348,18 +348,18 @@ var regexDomainFilterTests = []regexDomainFilterTest{ }, }, { - regexp.MustCompile("(?:foo|bar)\\.org$"), - regexp.MustCompile("^example\\.(?:foo|bar)\\.org$"), + regexp.MustCompile(`(?:foo|bar)\.org$`), + regexp.MustCompile(`^example\.(?:foo|bar)\.org$`), []string{"foo.org", "bar.org", "a.example.foo.org", "a.example.bar.org"}, true, map[string]string{ - "regexInclude": "(?:foo|bar)\\.org$", - "regexExclude": "^example\\.(?:foo|bar)\\.org$", + "regexInclude": `(?:foo|bar)\.org$`, + "regexExclude": `^example\.(?:foo|bar)\.org$`, }, }, { - regexp.MustCompile("(?:foo|bar)\\.org$"), - regexp.MustCompile("^example\\.(?:foo|bar)\\.org$"), + regexp.MustCompile(`(?:foo|bar)\.org$`), + regexp.MustCompile(`^example\.(?:foo|bar)\.org$`), []string{"example.foo.org", "example.bar.org"}, false, map[string]string{ @@ -368,8 +368,8 @@ var regexDomainFilterTests = []regexDomainFilterTest{ }, }, { - regexp.MustCompile("(?:foo|bar)\\.org$"), - regexp.MustCompile("^example\\.(?:foo|bar)\\.org$"), + regexp.MustCompile(`(?:foo|bar)\.org$`), + regexp.MustCompile(`^example\.(?:foo|bar)\.org$`), []string{"foo.org", "bar.org", "a.example.foo.org", "a.example.bar.org"}, true, map[string]string{ diff --git a/endpoint/endpoint.go b/endpoint/endpoint.go index 1bd2d54fb..69813bd7f 100644 --- a/endpoint/endpoint.go +++ b/endpoint/endpoint.go @@ -66,6 +66,14 @@ func NewTargets(target ...string) Targets { return t } +func NewTargetsFromAddr(targets []netip.Addr) Targets { + t := make(Targets, 0, len(targets)) + for _, target := range targets { + t = append(t, target.String()) + } + return t +} + func (t Targets) String() string { return strings.Join(t, ";") } diff --git a/go.mod b/go.mod index 8e45b2db3..b649c2b71 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module sigs.k8s.io/external-dns -go 1.23.3 +go 1.23.5 require ( cloud.google.com/go/compute/metadata v0.6.0 diff --git a/source/nat64source.go b/source/nat64source.go index dec879bd2..79bcf01d8 100644 --- a/source/nat64source.go +++ b/source/nat64source.go @@ -45,7 +45,7 @@ func (s *nat64Source) Endpoints(ctx context.Context) ([]*endpoint.Endpoint, erro } if pPrefix.Bits() != 96 { - return nil, fmt.Errorf("NAT64 prefixes need to be /96 prefixes.") + return nil, fmt.Errorf("NAT64 prefixes need to be /96 prefixes") } parsedNAT64Prefixes = append(parsedNAT64Prefixes, pPrefix) } @@ -88,7 +88,7 @@ func (s *nat64Source) Endpoints(ctx context.Context) ([]*endpoint.Endpoint, erro v4Addr, isOk := netip.AddrFromSlice(v4AddrBytes) if !isOk { - return nil, fmt.Errorf("Could not parse %v to IPv4 address", v4AddrBytes) + return nil, fmt.Errorf("could not parse %v to IPv4 address", v4AddrBytes) } v4Targets = append(v4Targets, v4Addr.String()) diff --git a/source/service_test.go b/source/service_test.go index 805988db1..125a29d15 100644 --- a/source/service_test.go +++ b/source/service_test.go @@ -411,8 +411,8 @@ func testServiceSourceEndpoints(t *testing.T) { serviceTypesFilter: []string{}, resolveLoadBalancerHostname: true, expected: []*endpoint.Endpoint{ - {DNSName: "foo.example.org", RecordType: endpoint.RecordTypeA, Targets: endpoint.Targets{exampleDotComIP4[0].String()}}, - {DNSName: "foo.example.org", RecordType: endpoint.RecordTypeAAAA, Targets: endpoint.Targets{exampleDotComIP6[0].String()}}, + {DNSName: "foo.example.org", RecordType: endpoint.RecordTypeA, Targets: endpoint.NewTargetsFromAddr(exampleDotComIP4)}, + {DNSName: "foo.example.org", RecordType: endpoint.RecordTypeAAAA, Targets: endpoint.NewTargetsFromAddr(exampleDotComIP6)}, }, }, {