forked from TrueCloudLab/lego
chore: update to go1.22 (#2144)
This commit is contained in:
parent
874e3ea023
commit
3371145f01
58 changed files with 18 additions and 87 deletions
2
.github/workflows/go-cross.yml
vendored
2
.github/workflows/go-cross.yml
vendored
|
@ -16,7 +16,7 @@ jobs:
|
||||||
|
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
go-version: [ stable, oldstable ]
|
go-version: [ stable ]
|
||||||
os: [ubuntu-latest, macos-latest, windows-latest]
|
os: [ubuntu-latest, macos-latest, windows-latest]
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
|
2
.github/workflows/pr.yml
vendored
2
.github/workflows/pr.yml
vendored
|
@ -13,7 +13,7 @@ jobs:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
env:
|
env:
|
||||||
GO_VERSION: stable
|
GO_VERSION: stable
|
||||||
GOLANGCI_LINT_VERSION: v1.56.1
|
GOLANGCI_LINT_VERSION: v1.57.1
|
||||||
HUGO_VERSION: 0.117.0
|
HUGO_VERSION: 0.117.0
|
||||||
CGO_ENABLED: 0
|
CGO_ENABLED: 0
|
||||||
LEGO_E2E_TESTS: CI
|
LEGO_E2E_TESTS: CI
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
run:
|
run:
|
||||||
timeout: 10m
|
timeout: 10m
|
||||||
skip-files: []
|
|
||||||
|
|
||||||
linters-settings:
|
linters-settings:
|
||||||
govet:
|
govet:
|
||||||
check-shadowing: true
|
enable:
|
||||||
|
- shadow
|
||||||
gocyclo:
|
gocyclo:
|
||||||
min-complexity: 12
|
min-complexity: 12
|
||||||
goconst:
|
goconst:
|
||||||
|
@ -139,6 +139,7 @@ linters:
|
||||||
- nonamedreturns
|
- nonamedreturns
|
||||||
- musttag # false-positive https://github.com/junk1tm/musttag/issues/17
|
- musttag # false-positive https://github.com/junk1tm/musttag/issues/17
|
||||||
- gosmopolitan # not relevant
|
- gosmopolitan # not relevant
|
||||||
|
- exportloopref # Useless with go1.22
|
||||||
|
|
||||||
issues:
|
issues:
|
||||||
exclude-use-default: false
|
exclude-use-default: false
|
||||||
|
@ -148,7 +149,7 @@ issues:
|
||||||
- 'Error return value of .((os\.)?std(out|err)\..*|.*Close|.*Flush|os\.Remove(All)?|.*printf?|os\.(Un)?Setenv). is not checked'
|
- 'Error return value of .((os\.)?std(out|err)\..*|.*Close|.*Flush|os\.Remove(All)?|.*printf?|os\.(Un)?Setenv). is not checked'
|
||||||
- 'exported (type|method|function) (.+) should have comment or be unexported'
|
- 'exported (type|method|function) (.+) should have comment or be unexported'
|
||||||
- 'ST1000: at least one file in a package should have a package comment'
|
- 'ST1000: at least one file in a package should have a package comment'
|
||||||
- 'fmt.Sprintf can be replaced with string addition'
|
- 'fmt.Sprintf can be replaced with string'
|
||||||
exclude-rules:
|
exclude-rules:
|
||||||
- path: (.+)_test.go
|
- path: (.+)_test.go
|
||||||
linters:
|
linters:
|
||||||
|
|
|
@ -94,7 +94,6 @@ func TestOrderService_NewWithOptions(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, test := range testCases {
|
for _, test := range testCases {
|
||||||
test := test
|
|
||||||
t.Run(test.desc, func(t *testing.T) {
|
t.Run(test.desc, func(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,6 @@ func Test_getLink(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, test := range testCases {
|
for _, test := range testCases {
|
||||||
test := test
|
|
||||||
t.Run(test.desc, func(t *testing.T) {
|
t.Run(test.desc, func(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
|
|
|
@ -86,7 +86,6 @@ func TestGenerateCSR(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, test := range testCases {
|
for _, test := range testCases {
|
||||||
test := test
|
|
||||||
t.Run(test.desc, func(t *testing.T) {
|
t.Run(test.desc, func(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@ func (c *Certifier) getAuthorizations(order acme.ExtendedOrder) ([]acme.Authoriz
|
||||||
var responses []acme.Authorization
|
var responses []acme.Authorization
|
||||||
|
|
||||||
failures := newObtainError()
|
failures := newObtainError()
|
||||||
for i := 0; i < len(order.Authorizations); i++ {
|
for range len(order.Authorizations) {
|
||||||
select {
|
select {
|
||||||
case res := <-resc:
|
case res := <-resc:
|
||||||
responses = append(responses, res)
|
responses = append(responses, res)
|
||||||
|
|
|
@ -112,7 +112,6 @@ func TestCertifier_GetRenewalInfo_errors(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, test := range testCases {
|
for _, test := range testCases {
|
||||||
test := test
|
|
||||||
t.Run(test.desc, func(t *testing.T) {
|
t.Run(test.desc, func(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
|
|
|
@ -215,7 +215,7 @@ func getChallengeFQDN(domain string, followCNAME bool) string {
|
||||||
}
|
}
|
||||||
|
|
||||||
// recursion counter so it doesn't spin out of control
|
// recursion counter so it doesn't spin out of control
|
||||||
for limit := 0; limit < 50; limit++ {
|
for range 50 {
|
||||||
// Keep following CNAMEs
|
// Keep following CNAMEs
|
||||||
r, err := dnsQuery(fqdn, dns.TypeCNAME, recursiveNameservers, true)
|
r, err := dnsQuery(fqdn, dns.TypeCNAME, recursiveNameservers, true)
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,6 @@ func TestExtractSubDomain(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, test := range testCases {
|
for _, test := range testCases {
|
||||||
test := test
|
|
||||||
t.Run(test.desc, func(t *testing.T) {
|
t.Run(test.desc, func(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
|
@ -93,7 +92,6 @@ func TestExtractSubDomain_errors(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, test := range testCases {
|
for _, test := range testCases {
|
||||||
test := test
|
|
||||||
t.Run(test.desc, func(t *testing.T) {
|
t.Run(test.desc, func(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,6 @@ func TestToFqdn(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, test := range testCases {
|
for _, test := range testCases {
|
||||||
test := test
|
|
||||||
t.Run(test.desc, func(t *testing.T) {
|
t.Run(test.desc, func(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
|
@ -54,7 +53,6 @@ func TestUnFqdn(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, test := range testCases {
|
for _, test := range testCases {
|
||||||
test := test
|
|
||||||
t.Run(test.desc, func(t *testing.T) {
|
t.Run(test.desc, func(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,6 @@ func TestLookupNameserversOK(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, test := range testCases {
|
for _, test := range testCases {
|
||||||
test := test
|
|
||||||
t.Run(test.fqdn, func(t *testing.T) {
|
t.Run(test.fqdn, func(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
|
@ -59,7 +58,6 @@ func TestLookupNameserversErr(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, test := range testCases {
|
for _, test := range testCases {
|
||||||
test := test
|
|
||||||
t.Run(test.desc, func(t *testing.T) {
|
t.Run(test.desc, func(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
|
@ -259,7 +257,6 @@ func TestDNSError_Error(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, test := range testCases {
|
for _, test := range testCases {
|
||||||
test := test
|
|
||||||
t.Run(test.desc, func(t *testing.T) {
|
t.Run(test.desc, func(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,6 @@ func TestCheckDNSPropagation(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, test := range testCases {
|
for _, test := range testCases {
|
||||||
test := test
|
|
||||||
t.Run(test.desc, func(t *testing.T) {
|
t.Run(test.desc, func(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
ClearFqdnCache()
|
ClearFqdnCache()
|
||||||
|
@ -69,7 +68,6 @@ func TestCheckAuthoritativeNss(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, test := range testCases {
|
for _, test := range testCases {
|
||||||
test := test
|
|
||||||
t.Run(test.desc, func(t *testing.T) {
|
t.Run(test.desc, func(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
ClearFqdnCache()
|
ClearFqdnCache()
|
||||||
|
@ -104,7 +102,6 @@ func TestCheckAuthoritativeNssErr(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, test := range testCases {
|
for _, test := range testCases {
|
||||||
test := test
|
|
||||||
t.Run(test.desc, func(t *testing.T) {
|
t.Run(test.desc, func(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
ClearFqdnCache()
|
ClearFqdnCache()
|
||||||
|
|
|
@ -69,7 +69,6 @@ func TestParseForwardedHeader(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, test := range testCases {
|
for _, test := range testCases {
|
||||||
test := test
|
|
||||||
t.Run(test.name, func(t *testing.T) {
|
t.Run(test.name, func(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
|
|
|
@ -57,7 +57,6 @@ func TestProviderServer_GetAddress(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, test := range testCases {
|
for _, test := range testCases {
|
||||||
test := test
|
|
||||||
t.Run(test.desc, func(t *testing.T) {
|
t.Run(test.desc, func(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
|
|
|
@ -99,7 +99,6 @@ func TestProber_Solve(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, test := range testCases {
|
for _, test := range testCases {
|
||||||
test := test
|
|
||||||
t.Run(test.desc, func(t *testing.T) {
|
t.Run(test.desc, func(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,6 @@ func Test_merge(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, test := range testCases {
|
for _, test := range testCases {
|
||||||
test := test
|
|
||||||
t.Run(test.desc, func(t *testing.T) {
|
t.Run(test.desc, func(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
|
@ -108,7 +107,6 @@ func Test_needRenewal(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, test := range testCases {
|
for _, test := range testCases {
|
||||||
test := test
|
|
||||||
t.Run(test.desc, func(t *testing.T) {
|
t.Run(test.desc, func(t *testing.T) {
|
||||||
actual := needRenewal(test.x509Cert, "foo.com", test.days)
|
actual := needRenewal(test.x509Cert, "foo.com", test.days)
|
||||||
|
|
||||||
|
|
|
@ -66,7 +66,7 @@ docker run goacme/lego -h
|
||||||
|
|
||||||
Requirements:
|
Requirements:
|
||||||
|
|
||||||
- go1.17+
|
- go1.22+.
|
||||||
- environment variable: `GO111MODULE=on`
|
- environment variable: `GO111MODULE=on`
|
||||||
|
|
||||||
To install the latest version from sources, just run:
|
To install the latest version from sources, just run:
|
||||||
|
|
2
go.mod
2
go.mod
|
@ -1,6 +1,6 @@
|
||||||
module github.com/go-acme/lego/v4
|
module github.com/go-acme/lego/v4
|
||||||
|
|
||||||
go 1.21
|
go 1.22
|
||||||
|
|
||||||
// github.com/exoscale/egoscale v1.19.0 => It is an error, please don't use it.
|
// github.com/exoscale/egoscale v1.19.0 => It is an error, please don't use it.
|
||||||
|
|
||||||
|
|
2
platform/config/env/env_test.go
vendored
2
platform/config/env/env_test.go
vendored
|
@ -93,7 +93,6 @@ func TestGetWithFallback(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, test := range testCases {
|
for _, test := range testCases {
|
||||||
test := test
|
|
||||||
t.Run(test.desc, func(t *testing.T) {
|
t.Run(test.desc, func(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
|
@ -166,7 +165,6 @@ func TestGetOneWithFallback(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, test := range testCases {
|
for _, test := range testCases {
|
||||||
test := test
|
|
||||||
t.Run(test.desc, func(t *testing.T) {
|
t.Run(test.desc, func(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
|
|
|
@ -76,8 +76,7 @@ func (d *DNSProviderPrivate) Present(domain, _, keyAuth string) error {
|
||||||
|
|
||||||
var txtRecords []*armprivatedns.TxtRecord
|
var txtRecords []*armprivatedns.TxtRecord
|
||||||
for txt := range uniqRecords {
|
for txt := range uniqRecords {
|
||||||
txtRecord := txt
|
txtRecords = append(txtRecords, &armprivatedns.TxtRecord{Value: to.SliceOfPtrs(txt)})
|
||||||
txtRecords = append(txtRecords, &armprivatedns.TxtRecord{Value: to.SliceOfPtrs(txtRecord)})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
rec := armprivatedns.RecordSet{
|
rec := armprivatedns.RecordSet{
|
||||||
|
|
|
@ -75,8 +75,7 @@ func (d *DNSProviderPublic) Present(domain, _, keyAuth string) error {
|
||||||
|
|
||||||
var txtRecords []*armdns.TxtRecord
|
var txtRecords []*armdns.TxtRecord
|
||||||
for txt := range uniqRecords {
|
for txt := range uniqRecords {
|
||||||
txtRecord := txt
|
txtRecords = append(txtRecords, &armdns.TxtRecord{Value: to.SliceOfPtrs(txt)})
|
||||||
txtRecords = append(txtRecords, &armdns.TxtRecord{Value: to.SliceOfPtrs(txtRecord)})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
rec := armdns.RecordSet{
|
rec := armdns.RecordSet{
|
||||||
|
|
|
@ -119,7 +119,6 @@ resources
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, test := range testCases {
|
for _, test := range testCases {
|
||||||
test := test
|
|
||||||
t.Run(test.desc, func(t *testing.T) {
|
t.Run(test.desc, func(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,6 @@ func TestClient_buildQuery(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, test := range testCases {
|
for _, test := range testCases {
|
||||||
test := test
|
|
||||||
t.Run(test.desc, func(t *testing.T) {
|
t.Run(test.desc, func(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
|
|
|
@ -55,7 +55,6 @@ func Test_getMainDomain(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, test := range testCases {
|
for _, test := range testCases {
|
||||||
test := test
|
|
||||||
t.Run(test.desc, func(t *testing.T) {
|
t.Run(test.desc, func(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
|
|
|
@ -92,7 +92,6 @@ func TestGetRootDomain(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, test := range testCases {
|
for _, test := range testCases {
|
||||||
test := test
|
|
||||||
t.Run(test.desc, func(t *testing.T) {
|
t.Run(test.desc, func(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
|
@ -181,7 +180,6 @@ func TestGetRecords(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, test := range testCases {
|
for _, test := range testCases {
|
||||||
test := test
|
|
||||||
t.Run(test.desc, func(t *testing.T) {
|
t.Run(test.desc, func(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
|
@ -232,7 +230,6 @@ func TestAddNewRecord(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, test := range testCases {
|
for _, test := range testCases {
|
||||||
test := test
|
|
||||||
t.Run(test.desc, func(t *testing.T) {
|
t.Run(test.desc, func(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
|
@ -290,7 +287,6 @@ func TestDeleteRecord(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, test := range testCases {
|
for _, test := range testCases {
|
||||||
test := test
|
|
||||||
t.Run(test.desc, func(t *testing.T) {
|
t.Run(test.desc, func(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
|
|
|
@ -169,7 +169,6 @@ func TestDNSProvider_findZone(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, test := range testCases {
|
for _, test := range testCases {
|
||||||
test := test
|
|
||||||
t.Run(test.desc, func(t *testing.T) {
|
t.Run(test.desc, func(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
|
|
|
@ -161,7 +161,6 @@ func TestDNSProvider_FindZoneAndRecordName(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, test := range testCases {
|
for _, test := range testCases {
|
||||||
test := test
|
|
||||||
t.Run(test.desc, func(t *testing.T) {
|
t.Run(test.desc, func(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
|
|
|
@ -131,7 +131,6 @@ func Test_extractAllZones(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, test := range testCases {
|
for _, test := range testCases {
|
||||||
test := test
|
|
||||||
t.Run(test.desc, func(t *testing.T) {
|
t.Run(test.desc, func(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
|
|
|
@ -152,7 +152,6 @@ func TestNewDNSProvider_Present(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, test := range testCases {
|
for _, test := range testCases {
|
||||||
test := test
|
|
||||||
t.Run(test.desc, func(t *testing.T) {
|
t.Run(test.desc, func(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
|
@ -229,7 +228,6 @@ func TestNewDNSProvider_Cleanup(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, test := range testCases {
|
for _, test := range testCases {
|
||||||
test := test
|
|
||||||
t.Run(test.desc, func(t *testing.T) {
|
t.Run(test.desc, func(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,6 @@ func TestClient_UpdateTxtRecord(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, test := range testCases {
|
for _, test := range testCases {
|
||||||
test := test
|
|
||||||
t.Run(test.code, func(t *testing.T) {
|
t.Run(test.code, func(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
|
|
|
@ -228,7 +228,7 @@ func splitDomain(domain string, zones []string) (string, string, error) {
|
||||||
var owner string
|
var owner string
|
||||||
var zone string
|
var zone string
|
||||||
|
|
||||||
for i := 0; i < len(parts)-1; i++ {
|
for i := range len(parts) - 1 {
|
||||||
zone = strings.Join(parts[i:], ".")
|
zone = strings.Join(parts[i:], ".")
|
||||||
if slices.Contains(zones, zone) {
|
if slices.Contains(zones, zone) {
|
||||||
baseOwner := strings.Join(parts[0:i], ".")
|
baseOwner := strings.Join(parts[0:i], ".")
|
||||||
|
|
|
@ -190,7 +190,6 @@ func TestSplitDomain(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, test := range testCases {
|
for _, test := range testCases {
|
||||||
test := test
|
|
||||||
t.Run(test.desc, func(t *testing.T) {
|
t.Run(test.desc, func(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
|
|
|
@ -171,7 +171,6 @@ func Test_computeSleep(t *testing.T) {
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
for _, test := range testCases {
|
for _, test := range testCases {
|
||||||
test := test
|
|
||||||
t.Run(test.desc, func(t *testing.T) {
|
t.Run(test.desc, func(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
|
|
|
@ -188,7 +188,6 @@ func findZone(zones []internal.Zone, domain string) *internal.Zone {
|
||||||
var result *internal.Zone
|
var result *internal.Zone
|
||||||
|
|
||||||
for _, zone := range zones {
|
for _, zone := range zones {
|
||||||
zone := zone
|
|
||||||
if zone.Name != "" && strings.HasSuffix(domain, zone.Name) {
|
if zone.Name != "" && strings.HasSuffix(domain, zone.Name) {
|
||||||
if result == nil || len(zone.Name) > len(result.Name) {
|
if result == nil || len(zone.Name) > len(result.Name) {
|
||||||
result = &zone
|
result = &zone
|
||||||
|
|
|
@ -78,7 +78,6 @@ func Test_splitDomain(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, test := range testCases {
|
for _, test := range testCases {
|
||||||
test := test
|
|
||||||
t.Run(test.desc, func(t *testing.T) {
|
t.Run(test.desc, func(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
|
|
|
@ -170,7 +170,6 @@ func Test_parseResponse(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, test := range testCases {
|
for _, test := range testCases {
|
||||||
test := test
|
|
||||||
t.Run(test.desc, func(t *testing.T) {
|
t.Run(test.desc, func(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
|
@ -221,7 +220,6 @@ func Test_RemoveTxtEntryFromZone(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, test := range testCases {
|
for _, test := range testCases {
|
||||||
test := test
|
|
||||||
t.Run(test.desc, func(t *testing.T) {
|
t.Run(test.desc, func(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
|
|
|
@ -238,7 +238,6 @@ func TestDNSProvider(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, test := range testCases {
|
for _, test := range testCases {
|
||||||
test := test
|
|
||||||
t.Run(test.desc, func(t *testing.T) {
|
t.Run(test.desc, func(t *testing.T) {
|
||||||
provider := setupTest(t, test.initRecs...)
|
provider := setupTest(t, test.initRecs...)
|
||||||
|
|
||||||
|
|
|
@ -180,7 +180,6 @@ func findZone(zones []internal.DNSZone, domain string) *internal.DNSZone {
|
||||||
var result *internal.DNSZone
|
var result *internal.DNSZone
|
||||||
|
|
||||||
for _, zone := range zones {
|
for _, zone := range zones {
|
||||||
zone := zone
|
|
||||||
if zone.Name != "" && strings.HasSuffix(domain, zone.Name) {
|
if zone.Name != "" && strings.HasSuffix(domain, zone.Name) {
|
||||||
if result == nil || len(zone.Name) > len(result.Name) {
|
if result == nil || len(zone.Name) > len(result.Name) {
|
||||||
result = &zone
|
result = &zone
|
||||||
|
|
|
@ -184,7 +184,6 @@ func TestDNSProvider_findZone(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, test := range testCases {
|
for _, test := range testCases {
|
||||||
test := test
|
|
||||||
t.Run(test.desc, func(t *testing.T) {
|
t.Run(test.desc, func(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
|
|
|
@ -203,7 +203,6 @@ func TestDomainSplit(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, test := range tests {
|
for _, test := range tests {
|
||||||
test := test
|
|
||||||
t.Run(test.domain, func(t *testing.T) {
|
t.Run(test.domain, func(t *testing.T) {
|
||||||
valid := true
|
valid := true
|
||||||
ch, err := newChallenge(test.domain, "")
|
ch, err := newChallenge(test.domain, "")
|
||||||
|
|
|
@ -135,7 +135,7 @@ func (c Signer) Sign(uri string, body, login, apiKey string) string {
|
||||||
func getRandomSalt() []byte {
|
func getRandomSalt() []byte {
|
||||||
// This is the only part of this that needs to be serialized.
|
// This is the only part of this that needs to be serialized.
|
||||||
salt := make([]byte, 16)
|
salt := make([]byte, 16)
|
||||||
for i := 0; i < 16; i++ {
|
for i := range 16 {
|
||||||
salt[i] = saltBytes[rand.Intn(len(saltBytes))]
|
salt[i] = saltBytes[rand.Intn(len(saltBytes))]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -199,7 +199,6 @@ func TestSigner_Sign(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, test := range testCases {
|
for _, test := range testCases {
|
||||||
test := test
|
|
||||||
t.Run(test.desc, func(t *testing.T) {
|
t.Run(test.desc, func(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
signer := NewSigner()
|
signer := NewSigner()
|
||||||
|
|
|
@ -124,7 +124,6 @@ func TestGetDNSRecordIdx(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, test := range testCases {
|
for _, test := range testCases {
|
||||||
test := test
|
|
||||||
t.Run(test.desc, func(t *testing.T) {
|
t.Run(test.desc, func(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
|
@ -288,7 +287,6 @@ func TestClient_GetDNSRecords_errors(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, test := range testCases {
|
for _, test := range testCases {
|
||||||
test := test
|
|
||||||
t.Run(test.desc, func(t *testing.T) {
|
t.Run(test.desc, func(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
|
|
|
@ -115,7 +115,6 @@ func TestClient_Login_errors(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, test := range testCases {
|
for _, test := range testCases {
|
||||||
test := test
|
|
||||||
t.Run(test.desc, func(t *testing.T) {
|
t.Run(test.desc, func(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
|
@ -202,7 +201,6 @@ func TestClient_Logout_errors(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, test := range testCases {
|
for _, test := range testCases {
|
||||||
test := test
|
|
||||||
t.Run(test.desc, func(t *testing.T) {
|
t.Run(test.desc, func(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
|
@ -230,9 +228,8 @@ func TestLiveClientAuth(t *testing.T) {
|
||||||
envTest.GetValue("NETCUP_API_PASSWORD"))
|
envTest.GetValue("NETCUP_API_PASSWORD"))
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
for i := 1; i < 4; i++ {
|
for i := range 4 {
|
||||||
i := i
|
t.Run("Test_"+strconv.Itoa(i+1), func(t *testing.T) {
|
||||||
t.Run("Test_"+strconv.Itoa(i), func(t *testing.T) {
|
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
ctx, err := client.CreateSessionContext(context.Background())
|
ctx, err := client.CreateSessionContext(context.Background())
|
||||||
|
|
|
@ -89,7 +89,6 @@ func TestChangeResourceRecordSetsErrors(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, test := range testCases {
|
for _, test := range testCases {
|
||||||
test := test
|
|
||||||
t.Run(test.desc, func(t *testing.T) {
|
t.Run(test.desc, func(t *testing.T) {
|
||||||
client := setupTest(t, test.responseBody, test.statusCode)
|
client := setupTest(t, test.responseBody, test.statusCode)
|
||||||
|
|
||||||
|
@ -157,7 +156,6 @@ func TestGetChangeErrors(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, test := range testCases {
|
for _, test := range testCases {
|
||||||
test := test
|
|
||||||
t.Run(test.desc, func(t *testing.T) {
|
t.Run(test.desc, func(t *testing.T) {
|
||||||
client := setupTest(t, test.responseBody, test.statusCode)
|
client := setupTest(t, test.responseBody, test.statusCode)
|
||||||
|
|
||||||
|
|
|
@ -144,7 +144,6 @@ func TestClient_joinPath(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, test := range testCases {
|
for _, test := range testCases {
|
||||||
test := test
|
|
||||||
t.Run(test.desc, func(t *testing.T) {
|
t.Run(test.desc, func(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
|
|
|
@ -61,7 +61,6 @@ func TestRemoveRecord_errors(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, test := range testCases {
|
for _, test := range testCases {
|
||||||
test := test
|
|
||||||
t.Run(test.desc, func(t *testing.T) {
|
t.Run(test.desc, func(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
|
@ -119,7 +118,6 @@ func TestAddTXTRecord_errors(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, test := range testCases {
|
for _, test := range testCases {
|
||||||
test := test
|
|
||||||
t.Run(test.desc, func(t *testing.T) {
|
t.Run(test.desc, func(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
|
|
|
@ -93,7 +93,7 @@ func TestDNSProvider_concurrentAddAndCleanupRecords(t *testing.T) {
|
||||||
dummyRecordCount := 10
|
dummyRecordCount := 10
|
||||||
|
|
||||||
var providers []*DNSProvider
|
var providers []*DNSProvider
|
||||||
for i := 0; i < dummyRecordCount; i++ {
|
for range dummyRecordCount {
|
||||||
config := NewDefaultConfig()
|
config := NewDefaultConfig()
|
||||||
config.Token = "token3"
|
config.Token = "token3"
|
||||||
config.Secret = "secret3"
|
config.Secret = "secret3"
|
||||||
|
|
|
@ -222,7 +222,6 @@ func TestTTLRounder(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, test := range testCases {
|
for _, test := range testCases {
|
||||||
test := test
|
|
||||||
t.Run(test.desc, func(t *testing.T) {
|
t.Run(test.desc, func(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,6 @@ func TestClient_SetRecord(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, test := range testCases {
|
for _, test := range testCases {
|
||||||
test := test
|
|
||||||
t.Run(test.desc, func(t *testing.T) {
|
t.Run(test.desc, func(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
|
|
|
@ -121,7 +121,6 @@ func TestNewDNSProviderConfig(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for desc, test := range testCases {
|
for desc, test := range testCases {
|
||||||
test := test
|
|
||||||
t.Run(desc, func(t *testing.T) {
|
t.Run(desc, func(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
|
|
|
@ -188,7 +188,6 @@ func TestDNSProvider_Present(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, test := range testCases {
|
for _, test := range testCases {
|
||||||
test := test
|
|
||||||
t.Run(test.desc, func(t *testing.T) {
|
t.Run(test.desc, func(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
|
|
|
@ -139,7 +139,7 @@ func TestDNSProvider_getHostedZone(t *testing.T) {
|
||||||
|
|
||||||
domains := []govultr.Domain{{Domain: "example.com"}, {Domain: "example.org"}, {Domain: "example.net"}}
|
domains := []govultr.Domain{{Domain: "example.com"}, {Domain: "example.org"}, {Domain: "example.net"}}
|
||||||
|
|
||||||
for i := 0; i < 50; i++ {
|
for i := range 50 {
|
||||||
domains = append(domains, govultr.Domain{Domain: fmt.Sprintf("my%02d.example.com", i)})
|
domains = append(domains, govultr.Domain{Domain: fmt.Sprintf("my%02d.example.com", i)})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -157,7 +157,6 @@ func TestDNSProvider_getHostedZone(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, test := range testCases {
|
for _, test := range testCases {
|
||||||
test := test
|
|
||||||
t.Run(test.desc, func(t *testing.T) {
|
t.Run(test.desc, func(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
|
|
|
@ -91,7 +91,6 @@ func TestClient_AddTXTRecord(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, test := range testCases {
|
for _, test := range testCases {
|
||||||
test := test
|
|
||||||
t.Run(test.desc, func(t *testing.T) {
|
t.Run(test.desc, func(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
|
@ -132,7 +131,6 @@ func TestClient_RemoveTxtRecord(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, test := range testCases {
|
for _, test := range testCases {
|
||||||
test := test
|
|
||||||
t.Run(test.desc, func(t *testing.T) {
|
t.Run(test.desc, func(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
|
|
|
@ -309,7 +309,6 @@ func TestGetRecords(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, test := range testCases {
|
for _, test := range testCases {
|
||||||
test := test
|
|
||||||
t.Run(test.desc, func(t *testing.T) {
|
t.Run(test.desc, func(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
client, mux := setupTest(t)
|
client, mux := setupTest(t)
|
||||||
|
|
|
@ -131,7 +131,6 @@ func (d *DNSProvider) CleanUp(domain, token, keyAuth string) error {
|
||||||
|
|
||||||
var record *internal.Record
|
var record *internal.Record
|
||||||
for _, rcd := range records {
|
for _, rcd := range records {
|
||||||
rcd := rcd
|
|
||||||
if rcd.Type == "TXT" && rcd.SubDomain == subDomain && rcd.Content == info.Value {
|
if rcd.Type == "TXT" && rcd.SubDomain == subDomain && rcd.Content == info.Value {
|
||||||
record = &rcd
|
record = &rcd
|
||||||
break
|
break
|
||||||
|
|
|
@ -178,7 +178,6 @@ func TestDNSProvider_Present(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, test := range testCases {
|
for _, test := range testCases {
|
||||||
test := test
|
|
||||||
t.Run(test.desc, func(t *testing.T) {
|
t.Run(test.desc, func(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
|
@ -187,7 +186,6 @@ func TestDNSProvider_Present(t *testing.T) {
|
||||||
t.Cleanup(server.Close)
|
t.Cleanup(server.Close)
|
||||||
|
|
||||||
for uri, handler := range test.handlers {
|
for uri, handler := range test.handlers {
|
||||||
handler := handler
|
|
||||||
mux.HandleFunc(uri, handler)
|
mux.HandleFunc(uri, handler)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -270,7 +268,6 @@ func TestDNSProvider_Cleanup(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, test := range testCases {
|
for _, test := range testCases {
|
||||||
test := test
|
|
||||||
t.Run(test.desc, func(t *testing.T) {
|
t.Run(test.desc, func(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
|
@ -279,7 +276,6 @@ func TestDNSProvider_Cleanup(t *testing.T) {
|
||||||
t.Cleanup(server.Close)
|
t.Cleanup(server.Close)
|
||||||
|
|
||||||
for uri, handler := range test.handlers {
|
for uri, handler := range test.handlers {
|
||||||
handler := handler
|
|
||||||
mux.HandleFunc(uri, handler)
|
mux.HandleFunc(uri, handler)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue