Skip to content

Commit

Permalink
chore: update to go1.22 (#2144)
Browse files Browse the repository at this point in the history
  • Loading branch information
ldez committed Mar 20, 2024
1 parent 874e3ea commit 3371145
Show file tree
Hide file tree
Showing 58 changed files with 18 additions and 87 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/go-cross.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:

strategy:
matrix:
go-version: [ stable, oldstable ]
go-version: [ stable ]
os: [ubuntu-latest, macos-latest, windows-latest]

steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 4 additions & 3 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
run:
timeout: 10m
skip-files: []

linters-settings:
govet:
check-shadowing: true
enable:
- shadow
gocyclo:
min-complexity: 12
goconst:
Expand Down Expand Up @@ -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
Expand All @@ -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:
Expand Down
1 change: 0 additions & 1 deletion acme/api/order_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
1 change: 0 additions & 1 deletion acme/api/service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
1 change: 0 additions & 1 deletion certcrypto/crypto_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
2 changes: 1 addition & 1 deletion certificate/authorization.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 0 additions & 1 deletion certificate/renewal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
2 changes: 1 addition & 1 deletion challenge/dns01/dns_challenge.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
2 changes: 0 additions & 2 deletions challenge/dns01/domain_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down Expand Up @@ -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()

Expand Down
2 changes: 0 additions & 2 deletions challenge/dns01/fqdn_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down Expand Up @@ -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()

Expand Down
3 changes: 0 additions & 3 deletions challenge/dns01/nameserver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down Expand Up @@ -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()

Expand Down Expand Up @@ -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()

Expand Down
3 changes: 0 additions & 3 deletions challenge/dns01/precheck_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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()
Expand Down
1 change: 0 additions & 1 deletion challenge/http01/domain_matcher_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
1 change: 0 additions & 1 deletion challenge/http01/http_challenge_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
1 change: 0 additions & 1 deletion challenge/resolver/prober_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
2 changes: 0 additions & 2 deletions cmd/cmd_renew_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion docs/content/installation/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -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.

Expand Down
2 changes: 0 additions & 2 deletions platform/config/env/env_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down Expand Up @@ -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()

Expand Down
3 changes: 1 addition & 2 deletions providers/dns/azuredns/private.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down
3 changes: 1 addition & 2 deletions providers/dns/azuredns/public.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down
1 change: 0 additions & 1 deletion providers/dns/azuredns/servicediscovery_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@ resources
}

for _, test := range testCases {
test := test
t.Run(test.desc, func(t *testing.T) {
t.Parallel()

Expand Down
1 change: 0 additions & 1 deletion providers/dns/dreamhost/internal/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
1 change: 0 additions & 1 deletion providers/dns/duckdns/internal/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
4 changes: 0 additions & 4 deletions providers/dns/dynu/internal/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down Expand Up @@ -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()

Expand Down Expand Up @@ -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()

Expand Down Expand Up @@ -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()

Expand Down
1 change: 0 additions & 1 deletion providers/dns/edgedns/edgedns_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
1 change: 0 additions & 1 deletion providers/dns/exoscale/exoscale_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
1 change: 0 additions & 1 deletion providers/dns/gcore/gcore_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
2 changes: 0 additions & 2 deletions providers/dns/httpreq/httpreq_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down Expand Up @@ -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()

Expand Down
1 change: 0 additions & 1 deletion providers/dns/hurricane/internal/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
2 changes: 1 addition & 1 deletion providers/dns/iij/iij.go
Original file line number Diff line number Diff line change
Expand Up @@ -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], ".")
Expand Down
1 change: 0 additions & 1 deletion providers/dns/iij/iij_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
1 change: 0 additions & 1 deletion providers/dns/inwx/inwx_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
Loading

0 comments on commit 3371145

Please sign in to comment.