Repository: go-acme/lego
Pull request #2144 (2024-03-20 02:56:28)

chore: update to go1.22
- update linter to v1.57.0

https://tip.golang.org/doc/go1.22


Patch:
diff --git a/.github/workflows/go-cross.yml b/.github/workflows/go-cross.yml
index 3f12fcc0..bcfdc62a 100644
--- a/.github/workflows/go-cross.yml
+++ b/.github/workflows/go-cross.yml
@@ -16,7 +16,7 @@ jobs:
 
     strategy:
       matrix:
-        go-version: [ stable, oldstable ]
+        go-version: [ stable ]
         os: [ubuntu-latest, macos-latest, windows-latest]
 
     steps:
diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml
index 015d3eba..e4501d23 100644
--- a/.github/workflows/pr.yml
+++ b/.github/workflows/pr.yml
@@ -13,7 +13,7 @@ jobs:
     runs-on: ubuntu-latest
     env:
       GO_VERSION: stable
-      GOLANGCI_LINT_VERSION: v1.56.1
+      GOLANGCI_LINT_VERSION: v1.57.1
       HUGO_VERSION: 0.117.0
       CGO_ENABLED: 0
       LEGO_E2E_TESTS: CI
diff --git a/.golangci.yml b/.golangci.yml
index 831b7606..5986d45e 100644
--- a/.golangci.yml
+++ b/.golangci.yml
@@ -1,10 +1,10 @@
 run:
   timeout: 10m
-  skip-files: []
 
 linters-settings:
   govet:
-    check-shadowing: true
+    enable:
+      - shadow
   gocyclo:
     min-complexity: 12
   goconst:
@@ -139,6 +139,7 @@ linters:
     - nonamedreturns
     - musttag # false-positive https://github.com/junk1tm/musttag/issues/17
     - gosmopolitan  # not relevant
+    - exportloopref # Useless with go1.22
 
 issues:
   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'
     - 'exported (type|method|function) (.+) should have comment or be unexported'
     - '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:
     - path: (.+)_test.go
       linters:
diff --git a/certificate/authorization.go b/certificate/authorization.go
index ce76ff8f..61c1244d 100644
--- a/certificate/authorization.go
+++ b/certificate/authorization.go
@@ -38,7 +38,7 @@ func (c *Certifier) getAuthorizations(order acme.ExtendedOrder) ([]acme.Authoriz
 	var responses []acme.Authorization
 
 	failures := newObtainError()
-	for i := 0; i < len(order.Authorizations); i++ {
+	for range len(order.Authorizations) {
 		select {
 		case res := <-resc:
 			responses = append(responses, res)
diff --git a/challenge/dns01/dns_challenge.go b/challenge/dns01/dns_challenge.go
index e0947e6b..8594d279 100644
--- a/challenge/dns01/dns_challenge.go
+++ b/challenge/dns01/dns_challenge.go
@@ -215,7 +215,7 @@ func getChallengeFQDN(domain string, followCNAME bool) string {
 	}
 
 	// recursion counter so it doesn't spin out of control
-	for limit := 0; limit < 50; limit++ {
+	for range 50 {
 		// Keep following CNAMEs
 		r, err := dnsQuery(fqdn, dns.TypeCNAME, recursiveNameservers, true)
 
diff --git a/docs/content/installation/_index.md b/docs/content/installation/_index.md
index 3cad4648..a3e88d3b 100644
--- a/docs/content/installation/_index.md
+++ b/docs/content/installation/_index.md
@@ -66,7 +66,7 @@ docker run goacme/lego -h
 
 Requirements:
 
-- go1.17+
+- go1.22+.
 - environment variable: `GO111MODULE=on`
 
 To install the latest version from sources, just run:
diff --git a/go.mod b/go.mod
index 9a49153a..4f8ebb70 100644
--- a/go.mod
+++ b/go.mod
@@ -1,6 +1,6 @@
 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.
 
diff --git a/providers/dns/azuredns/private.go b/providers/dns/azuredns/private.go
index 8e77bf4c..516879f3 100644
--- a/providers/dns/azuredns/private.go
+++ b/providers/dns/azuredns/private.go
@@ -76,8 +76,7 @@ func (d *DNSProviderPrivate) Present(domain, _, keyAuth string) error {
 
 	var txtRecords []*armprivatedns.TxtRecord
 	for txt := range uniqRecords {
-		txtRecord := txt
-		txtRecords = append(txtRecords, &armprivatedns.TxtRecord{Value: to.SliceOfPtrs(txtRecord)})
+		txtRecords = append(txtRecords, &armprivatedns.TxtRecord{Value: to.SliceOfPtrs(txt)})
 	}
 
 	rec := armprivatedns.RecordSet{
diff --git a/providers/dns/azuredns/public.go b/providers/dns/azuredns/public.go
index 07c00d32..0d0af53a 100644
--- a/providers/dns/azuredns/public.go
+++ b/providers/dns/azuredns/public.go
@@ -75,8 +75,7 @@ func (d *DNSProviderPublic) Present(domain, _, keyAuth string) error {
 
 	var txtRecords []*armdns.TxtRecord
 	for txt := range uniqRecords {
-		txtRecord := txt
-		txtRecords = append(txtRecords, &armdns.TxtRecord{Value: to.SliceOfPtrs(txtRecord)})
+		txtRecords = append(txtRecords, &armdns.TxtRecord{Value: to.SliceOfPtrs(txt)})
 	}
 
 	rec := armdns.RecordSet{
diff --git a/providers/dns/iij/iij.go b/providers/dns/iij/iij.go
index ed092932..f5d0fdf9 100644
--- a/providers/dns/iij/iij.go
+++ b/providers/dns/iij/iij.go
@@ -228,7 +228,7 @@ func splitDomain(domain string, zones []string) (string, string, error) {
 	var owner string
 	var zone string
 
-	for i := 0; i < len(parts)-1; i++ {
+	for i := range len(parts) - 1 {
 		zone = strings.Join(parts[i:], ".")
 		if slices.Contains(zones, zone) {
 			baseOwner := strings.Join(parts[0:i], ".")
diff --git a/providers/dns/ionos/ionos.go b/providers/dns/ionos/ionos.go
index 2ce3de62..6a778f2b 100644
--- a/providers/dns/ionos/ionos.go
+++ b/providers/dns/ionos/ionos.go
@@ -188,7 +188,6 @@ func findZone(zones []internal.Zone, domain string) *internal.Zone {
 	var result *internal.Zone
 
 	for _, zone := range zones {
-		zone := zone
 		if zone.Name != "" && strings.HasSuffix(domain, zone.Name) {
 			if result == nil || len(zone.Name) > len(result.Name) {
 				result = &zone
diff --git a/providers/dns/luadns/luadns.go b/providers/dns/luadns/luadns.go
index 86dfb7d2..97261e15 100644
--- a/providers/dns/luadns/luadns.go
+++ b/providers/dns/luadns/luadns.go
@@ -180,7 +180,6 @@ func findZone(zones []internal.DNSZone, domain string) *internal.DNSZone {
 	var result *internal.DNSZone
 
 	for _, zone := range zones {
-		zone := zone
 		if zone.Name != "" && strings.HasSuffix(domain, zone.Name) {
 			if result == nil || len(zone.Name) > len(result.Name) {
 				result = &zone
diff --git a/providers/dns/nearlyfreespeech/internal/client.go b/providers/dns/nearlyfreespeech/internal/client.go
index 25278847..08d8d511 100644
--- a/providers/dns/nearlyfreespeech/internal/client.go
+++ b/providers/dns/nearlyfreespeech/internal/client.go
@@ -135,7 +135,7 @@ func (c Signer) Sign(uri string, body, login, apiKey string) string {
 func getRandomSalt() []byte {
 	// This is the only part of this that needs to be serialized.
 	salt := make([]byte, 16)
-	for i := 0; i < 16; i++ {
+	for i := range 16 {
 		salt[i] = saltBytes[rand.Intn(len(saltBytes))]
 	}
 
diff --git a/providers/dns/yandex/yandex.go b/providers/dns/yandex/yandex.go
index 126aa2f9..2886a033 100644
--- a/providers/dns/yandex/yandex.go
+++ b/providers/dns/yandex/yandex.go
@@ -131,7 +131,6 @@ func (d *DNSProvider) CleanUp(domain, token, keyAuth string) error {
 
 	var record *internal.Record
 	for _, rcd := range records {
-		rcd := rcd
 		if rcd.Type == "TXT" && rcd.SubDomain == subDomain && rcd.Content == info.Value {
 			record = &rcd
 			break


Test patch:
diff --git a/acme/api/order_test.go b/acme/api/order_test.go
index c936aa10..26aaa371 100644
--- a/acme/api/order_test.go
+++ b/acme/api/order_test.go
@@ -94,7 +94,6 @@ func TestOrderService_NewWithOptions(t *testing.T) {
 	}
 
 	for _, test := range testCases {
-		test := test
 		t.Run(test.desc, func(t *testing.T) {
 			t.Parallel()
 
diff --git a/acme/api/service_test.go b/acme/api/service_test.go
index d0095a13..2dbd795c 100644
--- a/acme/api/service_test.go
+++ b/acme/api/service_test.go
@@ -44,7 +44,6 @@ func Test_getLink(t *testing.T) {
 	}
 
 	for _, test := range testCases {
-		test := test
 		t.Run(test.desc, func(t *testing.T) {
 			t.Parallel()
 
diff --git a/certcrypto/crypto_test.go b/certcrypto/crypto_test.go
index 39e8304f..7aba8b37 100644
--- a/certcrypto/crypto_test.go
+++ b/certcrypto/crypto_test.go
@@ -86,7 +86,6 @@ func TestGenerateCSR(t *testing.T) {
 	}
 
 	for _, test := range testCases {
-		test := test
 		t.Run(test.desc, func(t *testing.T) {
 			t.Parallel()
 
diff --git a/certificate/renewal_test.go b/certificate/renewal_test.go
index ef6fb399..e883a40c 100644
--- a/certificate/renewal_test.go
+++ b/certificate/renewal_test.go
@@ -112,7 +112,6 @@ func TestCertifier_GetRenewalInfo_errors(t *testing.T) {
 	}
 
 	for _, test := range testCases {
-		test := test
 		t.Run(test.desc, func(t *testing.T) {
 			t.Parallel()
 
diff --git a/challenge/dns01/domain_test.go b/challenge/dns01/domain_test.go
index fcb16a93..30e0ab9a 100644
--- a/challenge/dns01/domain_test.go
+++ b/challenge/dns01/domain_test.go
@@ -47,7 +47,6 @@ func TestExtractSubDomain(t *testing.T) {
 	}
 
 	for _, test := range testCases {
-		test := test
 		t.Run(test.desc, func(t *testing.T) {
 			t.Parallel()
 
@@ -93,7 +92,6 @@ func TestExtractSubDomain_errors(t *testing.T) {
 	}
 
 	for _, test := range testCases {
-		test := test
 		t.Run(test.desc, func(t *testing.T) {
 			t.Parallel()
 
diff --git a/challenge/dns01/fqdn_test.go b/challenge/dns01/fqdn_test.go
index 70bf01f3..a902667a 100644
--- a/challenge/dns01/fqdn_test.go
+++ b/challenge/dns01/fqdn_test.go
@@ -25,7 +25,6 @@ func TestToFqdn(t *testing.T) {
 	}
 
 	for _, test := range testCases {
-		test := test
 		t.Run(test.desc, func(t *testing.T) {
 			t.Parallel()
 
@@ -54,7 +53,6 @@ func TestUnFqdn(t *testing.T) {
 	}
 
 	for _, test := range testCases {
-		test := test
 		t.Run(test.desc, func(t *testing.T) {
 			t.Parallel()
 
diff --git a/challenge/dns01/nameserver_test.go b/challenge/dns01/nameserver_test.go
index 5a50f91b..15b19beb 100644
--- a/challenge/dns01/nameserver_test.go
+++ b/challenge/dns01/nameserver_test.go
@@ -30,7 +30,6 @@ func TestLookupNameserversOK(t *testing.T) {
 	}
 
 	for _, test := range testCases {
-		test := test
 		t.Run(test.fqdn, func(t *testing.T) {
 			t.Parallel()
 
@@ -59,7 +58,6 @@ func TestLookupNameserversErr(t *testing.T) {
 	}
 
 	for _, test := range testCases {
-		test := test
 		t.Run(test.desc, func(t *testing.T) {
 			t.Parallel()
 
@@ -259,7 +257,6 @@ func TestDNSError_Error(t *testing.T) {
 	}
 
 	for _, test := range testCases {
-		test := test
 		t.Run(test.desc, func(t *testing.T) {
 			t.Parallel()
 
diff --git a/challenge/dns01/precheck_test.go b/challenge/dns01/precheck_test.go
index 6bd73955..a2d9874b 100644
--- a/challenge/dns01/precheck_test.go
+++ b/challenge/dns01/precheck_test.go
@@ -28,7 +28,6 @@ func TestCheckDNSPropagation(t *testing.T) {
 	}
 
 	for _, test := range testCases {
-		test := test
 		t.Run(test.desc, func(t *testing.T) {
 			t.Parallel()
 			ClearFqdnCache()
@@ -69,7 +68,6 @@ func TestCheckAuthoritativeNss(t *testing.T) {
 	}
 
 	for _, test := range testCases {
-		test := test
 		t.Run(test.desc, func(t *testing.T) {
 			t.Parallel()
 			ClearFqdnCache()
@@ -104,7 +102,6 @@ func TestCheckAuthoritativeNssErr(t *testing.T) {
 	}
 
 	for _, test := range testCases {
-		test := test
 		t.Run(test.desc, func(t *testing.T) {
 			t.Parallel()
 			ClearFqdnCache()
diff --git a/challenge/http01/domain_matcher_test.go b/challenge/http01/domain_matcher_test.go
index 63d7ca7f..94add14b 100644
--- a/challenge/http01/domain_matcher_test.go
+++ b/challenge/http01/domain_matcher_test.go
@@ -69,7 +69,6 @@ func TestParseForwardedHeader(t *testing.T) {
 	}
 
 	for _, test := range testCases {
-		test := test
 		t.Run(test.name, func(t *testing.T) {
 			t.Parallel()
 
diff --git a/challenge/http01/http_challenge_test.go b/challenge/http01/http_challenge_test.go
index fa42f374..3a5aa6bb 100644
--- a/challenge/http01/http_challenge_test.go
+++ b/challenge/http01/http_challenge_test.go
@@ -57,7 +57,6 @@ func TestProviderServer_GetAddress(t *testing.T) {
 	}
 
 	for _, test := range testCases {
-		test := test
 		t.Run(test.desc, func(t *testing.T) {
 			t.Parallel()
 
diff --git a/challenge/resolver/prober_test.go b/challenge/resolver/prober_test.go
index 129842d4..4ee9b1b4 100644
--- a/challenge/resolver/prober_test.go
+++ b/challenge/resolver/prober_test.go
@@ -99,7 +99,6 @@ func TestProber_Solve(t *testing.T) {
 	}
 
 	for _, test := range testCases {
-		test := test
 		t.Run(test.desc, func(t *testing.T) {
 			t.Parallel()
 
diff --git a/cmd/cmd_renew_test.go b/cmd/cmd_renew_test.go
index 0ad95264..f88ad74c 100644
--- a/cmd/cmd_renew_test.go
+++ b/cmd/cmd_renew_test.go
@@ -48,7 +48,6 @@ func Test_merge(t *testing.T) {
 	}
 
 	for _, test := range testCases {
-		test := test
 		t.Run(test.desc, func(t *testing.T) {
 			t.Parallel()
 
@@ -108,7 +107,6 @@ func Test_needRenewal(t *testing.T) {
 	}
 
 	for _, test := range testCases {
-		test := test
 		t.Run(test.desc, func(t *testing.T) {
 			actual := needRenewal(test.x509Cert, "foo.com", test.days)
 
diff --git a/platform/config/env/env_test.go b/platform/config/env/env_test.go
index 3de55b5c..4a3d0a04 100644
--- a/platform/config/env/env_test.go
+++ b/platform/config/env/env_test.go
@@ -93,7 +93,6 @@ func TestGetWithFallback(t *testing.T) {
 	}
 
 	for _, test := range testCases {
-		test := test
 		t.Run(test.desc, func(t *testing.T) {
 			t.Parallel()
 
@@ -166,7 +165,6 @@ func TestGetOneWithFallback(t *testing.T) {
 	}
 
 	for _, test := range testCases {
-		test := test
 		t.Run(test.desc, func(t *testing.T) {
 			t.Parallel()
 
diff --git a/providers/dns/azuredns/servicediscovery_test.go b/providers/dns/azuredns/servicediscovery_test.go
index 6bf8b033..539ac9d4 100644
--- a/providers/dns/azuredns/servicediscovery_test.go
+++ b/providers/dns/azuredns/servicediscovery_test.go
@@ -119,7 +119,6 @@ resources
 	}
 
 	for _, test := range testCases {
-		test := test
 		t.Run(test.desc, func(t *testing.T) {
 			t.Parallel()
 
diff --git a/providers/dns/dreamhost/internal/client_test.go b/providers/dns/dreamhost/internal/client_test.go
index 348c50ce..eff520df 100644
--- a/providers/dns/dreamhost/internal/client_test.go
+++ b/providers/dns/dreamhost/internal/client_test.go
@@ -38,7 +38,6 @@ func TestClient_buildQuery(t *testing.T) {
 	}
 
 	for _, test := range testCases {
-		test := test
 		t.Run(test.desc, func(t *testing.T) {
 			t.Parallel()
 
diff --git a/providers/dns/duckdns/internal/client_test.go b/providers/dns/duckdns/internal/client_test.go
index ec3196a7..4df17d04 100644
--- a/providers/dns/duckdns/internal/client_test.go
+++ b/providers/dns/duckdns/internal/client_test.go
@@ -55,7 +55,6 @@ func Test_getMainDomain(t *testing.T) {
 	}
 
 	for _, test := range testCases {
-		test := test
 		t.Run(test.desc, func(t *testing.T) {
 			t.Parallel()
 
diff --git a/providers/dns/dynu/internal/client_test.go b/providers/dns/dynu/internal/client_test.go
index 005ceff1..7f33bc2c 100644
--- a/providers/dns/dynu/internal/client_test.go
+++ b/providers/dns/dynu/internal/client_test.go
@@ -92,7 +92,6 @@ func TestGetRootDomain(t *testing.T) {
 	}
 
 	for _, test := range testCases {
-		test := test
 		t.Run(test.desc, func(t *testing.T) {
 			t.Parallel()
 
@@ -181,7 +180,6 @@ func TestGetRecords(t *testing.T) {
 	}
 
 	for _, test := range testCases {
-		test := test
 		t.Run(test.desc, func(t *testing.T) {
 			t.Parallel()
 
@@ -232,7 +230,6 @@ func TestAddNewRecord(t *testing.T) {
 	}
 
 	for _, test := range testCases {
-		test := test
 		t.Run(test.desc, func(t *testing.T) {
 			t.Parallel()
 
@@ -290,7 +287,6 @@ func TestDeleteRecord(t *testing.T) {
 	}
 
 	for _, test := range testCases {
-		test := test
 		t.Run(test.desc, func(t *testing.T) {
 			t.Parallel()
 
diff --git a/providers/dns/edgedns/edgedns_test.go b/providers/dns/edgedns/edgedns_test.go
index 85302cb5..9bb76580 100644
--- a/providers/dns/edgedns/edgedns_test.go
+++ b/providers/dns/edgedns/edgedns_test.go
@@ -169,7 +169,6 @@ func TestDNSProvider_findZone(t *testing.T) {
 	}
 
 	for _, test := range testCases {
-		test := test
 		t.Run(test.desc, func(t *testing.T) {
 			t.Parallel()
 
diff --git a/providers/dns/exoscale/exoscale_test.go b/providers/dns/exoscale/exoscale_test.go
index 059698cd..fa58216a 100644
--- a/providers/dns/exoscale/exoscale_test.go
+++ b/providers/dns/exoscale/exoscale_test.go
@@ -161,7 +161,6 @@ func TestDNSProvider_FindZoneAndRecordName(t *testing.T) {
 	}
 
 	for _, test := range testCases {
-		test := test
 		t.Run(test.desc, func(t *testing.T) {
 			t.Parallel()
 
diff --git a/providers/dns/gcore/gcore_test.go b/providers/dns/gcore/gcore_test.go
index ba905c2c..a5eddee7 100644
--- a/providers/dns/gcore/gcore_test.go
+++ b/providers/dns/gcore/gcore_test.go
@@ -131,7 +131,6 @@ func Test_extractAllZones(t *testing.T) {
 	}
 
 	for _, test := range testCases {
-		test := test
 		t.Run(test.desc, func(t *testing.T) {
 			t.Parallel()
 
diff --git a/providers/dns/httpreq/httpreq_test.go b/providers/dns/httpreq/httpreq_test.go
index a545bd17..8dc36ccc 100644
--- a/providers/dns/httpreq/httpreq_test.go
+++ b/providers/dns/httpreq/httpreq_test.go
@@ -152,7 +152,6 @@ func TestNewDNSProvider_Present(t *testing.T) {
 	}
 
 	for _, test := range testCases {
-		test := test
 		t.Run(test.desc, func(t *testing.T) {
 			t.Parallel()
 
@@ -229,7 +228,6 @@ func TestNewDNSProvider_Cleanup(t *testing.T) {
 	}
 
 	for _, test := range testCases {
-		test := test
 		t.Run(test.desc, func(t *testing.T) {
 			t.Parallel()
 
diff --git a/providers/dns/hurricane/internal/client_test.go b/providers/dns/hurricane/internal/client_test.go
index 16d4f60f..2862c248 100644
--- a/providers/dns/hurricane/internal/client_test.go
+++ b/providers/dns/hurricane/internal/client_test.go
@@ -46,7 +46,6 @@ func TestClient_UpdateTxtRecord(t *testing.T) {
 	}
 
 	for _, test := range testCases {
-		test := test
 		t.Run(test.code, func(t *testing.T) {
 			t.Parallel()
 
diff --git a/providers/dns/iij/iij_test.go b/providers/dns/iij/iij_test.go
index 39547cdd..936dd9b8 100644
--- a/providers/dns/iij/iij_test.go
+++ b/providers/dns/iij/iij_test.go
@@ -190,7 +190,6 @@ func TestSplitDomain(t *testing.T) {
 	}
 
 	for _, test := range testCases {
-		test := test
 		t.Run(test.desc, func(t *testing.T) {
 			t.Parallel()
 
diff --git a/providers/dns/inwx/inwx_test.go b/providers/dns/inwx/inwx_test.go
index f0c8f367..39ce7d70 100644
--- a/providers/dns/inwx/inwx_test.go
+++ b/providers/dns/inwx/inwx_test.go
@@ -171,7 +171,6 @@ func Test_computeSleep(t *testing.T) {
 	require.NoError(t, err)
 
 	for _, test := range testCases {
-		test := test
 		t.Run(test.desc, func(t *testing.T) {
 			t.Parallel()
 
diff --git a/providers/dns/ipv64/ipv64_test.go b/providers/dns/ipv64/ipv64_test.go
index 114919ee..b3fe142e 100644
--- a/providers/dns/ipv64/ipv64_test.go
+++ b/providers/dns/ipv64/ipv64_test.go
@@ -78,7 +78,6 @@ func Test_splitDomain(t *testing.T) {
 	}
 
 	for _, test := range testCases {
-		test := test
 		t.Run(test.desc, func(t *testing.T) {
 			t.Parallel()
 
diff --git a/providers/dns/joker/internal/dmapi/client_test.go b/providers/dns/joker/internal/dmapi/client_test.go
index a1240b7c..dc6653bf 100644
--- a/providers/dns/joker/internal/dmapi/client_test.go
+++ b/providers/dns/joker/internal/dmapi/client_test.go
@@ -170,7 +170,6 @@ func Test_parseResponse(t *testing.T) {
 	}
 
 	for _, test := range testCases {
-		test := test
 		t.Run(test.desc, func(t *testing.T) {
 			t.Parallel()
 
@@ -221,7 +220,6 @@ func Test_RemoveTxtEntryFromZone(t *testing.T) {
 	}
 
 	for _, test := range testCases {
-		test := test
 		t.Run(test.desc, func(t *testing.T) {
 			t.Parallel()
 
diff --git a/providers/dns/liquidweb/liquidweb_test.go b/providers/dns/liquidweb/liquidweb_test.go
index c62ff65f..a26b18e1 100644
--- a/providers/dns/liquidweb/liquidweb_test.go
+++ b/providers/dns/liquidweb/liquidweb_test.go
@@ -238,7 +238,6 @@ func TestDNSProvider(t *testing.T) {
 	}
 
 	for _, test := range testCases {
-		test := test
 		t.Run(test.desc, func(t *testing.T) {
 			provider := setupTest(t, test.initRecs...)
 
diff --git a/providers/dns/luadns/luadns_test.go b/providers/dns/luadns/luadns_test.go
index e83aab11..ea4d06ae 100644
--- a/providers/dns/luadns/luadns_test.go
+++ b/providers/dns/luadns/luadns_test.go
@@ -184,7 +184,6 @@ func TestDNSProvider_findZone(t *testing.T) {
 	}
 
 	for _, test := range testCases {
-		test := test
 		t.Run(test.desc, func(t *testing.T) {
 			t.Parallel()
 
diff --git a/providers/dns/namecheap/namecheap_test.go b/providers/dns/namecheap/namecheap_test.go
index e3cbb78b..4f4036de 100644
--- a/providers/dns/namecheap/namecheap_test.go
+++ b/providers/dns/namecheap/namecheap_test.go
@@ -203,7 +203,6 @@ func TestDomainSplit(t *testing.T) {
 	}
 
 	for _, test := range tests {
-		test := test
 		t.Run(test.domain, func(t *testing.T) {
 			valid := true
 			ch, err := newChallenge(test.domain, "")
diff --git a/providers/dns/nearlyfreespeech/internal/client_test.go b/providers/dns/nearlyfreespeech/internal/client_test.go
index 16fa82e8..935ee4ff 100644
--- a/providers/dns/nearlyfreespeech/internal/client_test.go
+++ b/providers/dns/nearlyfreespeech/internal/client_test.go
@@ -199,7 +199,6 @@ func TestSigner_Sign(t *testing.T) {
 	}
 
 	for _, test := range testCases {
-		test := test
 		t.Run(test.desc, func(t *testing.T) {
 			t.Parallel()
 			signer := NewSigner()
diff --git a/providers/dns/netcup/internal/client_test.go b/providers/dns/netcup/internal/client_test.go
index 25d49436..0e028e88 100644
--- a/providers/dns/netcup/internal/client_test.go
+++ b/providers/dns/netcup/internal/client_test.go
@@ -124,7 +124,6 @@ func TestGetDNSRecordIdx(t *testing.T) {
 	}
 
 	for _, test := range testCases {
-		test := test
 		t.Run(test.desc, func(t *testing.T) {
 			t.Parallel()
 
@@ -288,7 +287,6 @@ func TestClient_GetDNSRecords_errors(t *testing.T) {
 	}
 
 	for _, test := range testCases {
-		test := test
 		t.Run(test.desc, func(t *testing.T) {
 			t.Parallel()
 
diff --git a/providers/dns/netcup/internal/session_test.go b/providers/dns/netcup/internal/session_test.go
index ab605779..2b69265d 100644
--- a/providers/dns/netcup/internal/session_test.go
+++ b/providers/dns/netcup/internal/session_test.go
@@ -115,7 +115,6 @@ func TestClient_Login_errors(t *testing.T) {
 	}
 
 	for _, test := range testCases {
-		test := test
 		t.Run(test.desc, func(t *testing.T) {
 			t.Parallel()
 
@@ -202,7 +201,6 @@ func TestClient_Logout_errors(t *testing.T) {
 	}
 
 	for _, test := range testCases {
-		test := test
 		t.Run(test.desc, func(t *testing.T) {
 			t.Parallel()
 
@@ -230,9 +228,8 @@ func TestLiveClientAuth(t *testing.T) {
 		envTest.GetValue("NETCUP_API_PASSWORD"))
 	require.NoError(t, err)
 
-	for i := 1; i < 4; i++ {
-		i := i
-		t.Run("Test_"+strconv.Itoa(i), func(t *testing.T) {
+	for i := range 4 {
+		t.Run("Test_"+strconv.Itoa(i+1), func(t *testing.T) {
 			t.Parallel()
 
 			ctx, err := client.CreateSessionContext(context.Background())
diff --git a/providers/dns/nifcloud/internal/client_test.go b/providers/dns/nifcloud/internal/client_test.go
index 38a220b6..06c4921e 100644
--- a/providers/dns/nifcloud/internal/client_test.go
+++ b/providers/dns/nifcloud/internal/client_test.go
@@ -89,7 +89,6 @@ func TestChangeResourceRecordSetsErrors(t *testing.T) {
 	}
 
 	for _, test := range testCases {
-		test := test
 		t.Run(test.desc, func(t *testing.T) {
 			client := setupTest(t, test.responseBody, test.statusCode)
 
@@ -157,7 +156,6 @@ func TestGetChangeErrors(t *testing.T) {
 	}
 
 	for _, test := range testCases {
-		test := test
 		t.Run(test.desc, func(t *testing.T) {
 			client := setupTest(t, test.responseBody, test.statusCode)
 
diff --git a/providers/dns/pdns/internal/client_test.go b/providers/dns/pdns/internal/client_test.go
index 4e17a4fd..8d0aaab6 100644
--- a/providers/dns/pdns/internal/client_test.go
+++ b/providers/dns/pdns/internal/client_test.go
@@ -144,7 +144,6 @@ func TestClient_joinPath(t *testing.T) {
 	}
 
 	for _, test := range testCases {
-		test := test
 		t.Run(test.desc, func(t *testing.T) {
 			t.Parallel()
 
diff --git a/providers/dns/regru/internal/client_test.go b/providers/dns/regru/internal/client_test.go
index a599a2c3..fa3f1670 100644
--- a/providers/dns/regru/internal/client_test.go
+++ b/providers/dns/regru/internal/client_test.go
@@ -61,7 +61,6 @@ func TestRemoveRecord_errors(t *testing.T) {
 	}
 
 	for _, test := range testCases {
-		test := test
 		t.Run(test.desc, func(t *testing.T) {
 			t.Parallel()
 
@@ -119,7 +118,6 @@ func TestAddTXTRecord_errors(t *testing.T) {
 	}
 
 	for _, test := range testCases {
-		test := test
 		t.Run(test.desc, func(t *testing.T) {
 			t.Parallel()
 
diff --git a/providers/dns/sakuracloud/wrapper_test.go b/providers/dns/sakuracloud/wrapper_test.go
index 59f9e24a..91cd3ce0 100644
--- a/providers/dns/sakuracloud/wrapper_test.go
+++ b/providers/dns/sakuracloud/wrapper_test.go
@@ -93,7 +93,7 @@ func TestDNSProvider_concurrentAddAndCleanupRecords(t *testing.T) {
 	dummyRecordCount := 10
 
 	var providers []*DNSProvider
-	for i := 0; i < dummyRecordCount; i++ {
+	for range dummyRecordCount {
 		config := NewDefaultConfig()
 		config.Token = "token3"
 		config.Secret = "secret3"
diff --git a/providers/dns/shellrent/internal/client_test.go b/providers/dns/shellrent/internal/client_test.go
index cf021ae9..0fe77c6f 100644
--- a/providers/dns/shellrent/internal/client_test.go
+++ b/providers/dns/shellrent/internal/client_test.go
@@ -222,7 +222,6 @@ func TestTTLRounder(t *testing.T) {
 	}
 
 	for _, test := range testCases {
-		test := test
 		t.Run(test.desc, func(t *testing.T) {
 			t.Parallel()
 
diff --git a/providers/dns/sonic/internal/client_test.go b/providers/dns/sonic/internal/client_test.go
index f4a6105e..ac711387 100644
--- a/providers/dns/sonic/internal/client_test.go
+++ b/providers/dns/sonic/internal/client_test.go
@@ -48,7 +48,6 @@ func TestClient_SetRecord(t *testing.T) {
 	}
 
 	for _, test := range testCases {
-		test := test
 		t.Run(test.desc, func(t *testing.T) {
 			t.Parallel()
 
diff --git a/providers/dns/stackpath/stackpath_test.go b/providers/dns/stackpath/stackpath_test.go
index a72f268a..f8b83140 100644
--- a/providers/dns/stackpath/stackpath_test.go
+++ b/providers/dns/stackpath/stackpath_test.go
@@ -121,7 +121,6 @@ func TestNewDNSProviderConfig(t *testing.T) {
 	}
 
 	for desc, test := range testCases {
-		test := test
 		t.Run(desc, func(t *testing.T) {
 			t.Parallel()
 
diff --git a/providers/dns/vinyldns/vinyldns_test.go b/providers/dns/vinyldns/vinyldns_test.go
index c05b5a73..8bfb192c 100644
--- a/providers/dns/vinyldns/vinyldns_test.go
+++ b/providers/dns/vinyldns/vinyldns_test.go
@@ -188,7 +188,6 @@ func TestDNSProvider_Present(t *testing.T) {
 	}
 
 	for _, test := range testCases {
-		test := test
 		t.Run(test.desc, func(t *testing.T) {
 			t.Parallel()
 
diff --git a/providers/dns/vultr/vultr_test.go b/providers/dns/vultr/vultr_test.go
index 2f03e337..964c0960 100644
--- a/providers/dns/vultr/vultr_test.go
+++ b/providers/dns/vultr/vultr_test.go
@@ -139,7 +139,7 @@ func TestDNSProvider_getHostedZone(t *testing.T) {
 
 	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)})
 	}
 
@@ -157,7 +157,6 @@ func TestDNSProvider_getHostedZone(t *testing.T) {
 	}
 
 	for _, test := range testCases {
-		test := test
 		t.Run(test.desc, func(t *testing.T) {
 			t.Parallel()
 
diff --git a/providers/dns/webnames/internal/client_test.go b/providers/dns/webnames/internal/client_test.go
index 0f66eb8b..8885c50d 100644
--- a/providers/dns/webnames/internal/client_test.go
+++ b/providers/dns/webnames/internal/client_test.go
@@ -91,7 +91,6 @@ func TestClient_AddTXTRecord(t *testing.T) {
 	}
 
 	for _, test := range testCases {
-		test := test
 		t.Run(test.desc, func(t *testing.T) {
 			t.Parallel()
 
@@ -132,7 +131,6 @@ func TestClient_RemoveTxtRecord(t *testing.T) {
 	}
 
 	for _, test := range testCases {
-		test := test
 		t.Run(test.desc, func(t *testing.T) {
 			t.Parallel()
 
diff --git a/providers/dns/yandex/internal/client_test.go b/providers/dns/yandex/internal/client_test.go
index 346b1ff6..67166ee8 100644
--- a/providers/dns/yandex/internal/client_test.go
+++ b/providers/dns/yandex/internal/client_test.go
@@ -309,7 +309,6 @@ func TestGetRecords(t *testing.T) {
 	}
 
 	for _, test := range testCases {
-		test := test
 		t.Run(test.desc, func(t *testing.T) {
 			t.Parallel()
 			client, mux := setupTest(t)
diff --git a/providers/dns/zoneee/zoneee_test.go b/providers/dns/zoneee/zoneee_test.go
index 7a284266..1f2909fa 100644
--- a/providers/dns/zoneee/zoneee_test.go
+++ b/providers/dns/zoneee/zoneee_test.go
@@ -178,7 +178,6 @@ func TestDNSProvider_Present(t *testing.T) {
 	}
 
 	for _, test := range testCases {
-		test := test
 		t.Run(test.desc, func(t *testing.T) {
 			t.Parallel()
 
@@ -187,7 +186,6 @@ func TestDNSProvider_Present(t *testing.T) {
 			t.Cleanup(server.Close)
 
 			for uri, handler := range test.handlers {
-				handler := handler
 				mux.HandleFunc(uri, handler)
 			}
 
@@ -270,7 +268,6 @@ func TestDNSProvider_Cleanup(t *testing.T) {
 	}
 
 	for _, test := range testCases {
-		test := test
 		t.Run(test.desc, func(t *testing.T) {
 			t.Parallel()
 
@@ -279,7 +276,6 @@ func TestDNSProvider_Cleanup(t *testing.T) {
 			t.Cleanup(server.Close)
 
 			for uri, handler := range test.handlers {
-				handler := handler
 				mux.HandleFunc(uri, handler)
 			}