chore(ci): fix failing test, upgrade to go 1.23.5 and linter to v1.63

This commit is contained in:
Michel Loiseleur 2025-01-17 21:05:08 +01:00
parent 36478f1fc5
commit cc546820dc
7 changed files with 26 additions and 18 deletions

View File

@ -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

View File

@ -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

View File

@ -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{

View File

@ -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, ";")
}

2
go.mod
View File

@ -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

View File

@ -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())

View File

@ -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)},
},
},
{