Repository: go-acme/lego
Pull request #2046 (2023-10-30 20:44:10)

chore: update linter
Update golangci-lint to v1.55.1


Patch:
diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml
index 3ad804d0..e4660bf7 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.54.1
+      GOLANGCI_LINT_VERSION: v1.55.1
       HUGO_VERSION: '0.117.0'
       CGO_ENABLED: 0
       LEGO_E2E_TESTS: CI
diff --git a/.golangci.yml b/.golangci.yml
index b84462b4..03bf1f99 100644
--- a/.golangci.yml
+++ b/.golangci.yml
@@ -88,6 +88,19 @@ linters-settings:
         disabled: true
       - name: unreachable-code
       - name: redefines-builtin-id
+  testifylint:
+    enable:
+      - bool-compare
+      - compares
+      - empty
+      - error-is-as
+      - error-nil
+      - expected-actual
+      - float-compare
+      - len
+      - suite-dont-use-pkg
+      - suite-extra-assert-call
+      - suite-thelper
 
 linters:
   enable-all: true
diff --git a/cmd/zz_gen_cmd_dnshelp.go b/cmd/zz_gen_cmd_dnshelp.go
index 3440bcd8..4edcff94 100644
--- a/cmd/zz_gen_cmd_dnshelp.go
+++ b/cmd/zz_gen_cmd_dnshelp.go
@@ -1635,17 +1635,17 @@ func displayDNSHelp(w io.Writer, name string) error {
 		ew.writeln()
 
 		ew.writeln(`Credentials:`)
-		ew.writeln(`	- "LIQUID_WEB_PASSWORD":	Liquid Web API Password`)
-		ew.writeln(`	- "LIQUID_WEB_USERNAME":	Liquid Web API Username`)
+		ew.writeln(`	- "LWAPI_PASSWORD":	Liquid Web API Password`)
+		ew.writeln(`	- "LWAPI_USERNAME":	Liquid Web API Username`)
 		ew.writeln()
 
 		ew.writeln(`Additional Configuration:`)
-		ew.writeln(`	- "LIQUID_WEB_HTTP_TIMEOUT":	Maximum waiting time for the DNS records to be created (not verified)`)
-		ew.writeln(`	- "LIQUID_WEB_POLLING_INTERVAL":	Time between DNS propagation check`)
-		ew.writeln(`	- "LIQUID_WEB_PROPAGATION_TIMEOUT":	Maximum waiting time for DNS propagation`)
-		ew.writeln(`	- "LIQUID_WEB_TTL":	The TTL of the TXT record used for the DNS challenge`)
-		ew.writeln(`	- "LIQUID_WEB_URL":	Liquid Web API endpoint`)
-		ew.writeln(`	- "LIQUID_WEB_ZONE":	DNS Zone`)
+		ew.writeln(`	- "LWAPI_HTTP_TIMEOUT":	Maximum waiting time for the DNS records to be created (not verified)`)
+		ew.writeln(`	- "LWAPI_POLLING_INTERVAL":	Time between DNS propagation check`)
+		ew.writeln(`	- "LWAPI_PROPAGATION_TIMEOUT":	Maximum waiting time for DNS propagation`)
+		ew.writeln(`	- "LWAPI_TTL":	The TTL of the TXT record used for the DNS challenge`)
+		ew.writeln(`	- "LWAPI_URL":	Liquid Web API endpoint`)
+		ew.writeln(`	- "LWAPI_ZONE":	DNS Zone`)
 
 		ew.writeln()
 		ew.writeln(`More information: https://go-acme.github.io/lego/dns/liquidweb`)
diff --git a/docs/content/dns/zz_gen_liquidweb.md b/docs/content/dns/zz_gen_liquidweb.md
index 64721310..60ce8951 100644
--- a/docs/content/dns/zz_gen_liquidweb.md
+++ b/docs/content/dns/zz_gen_liquidweb.md
@@ -26,8 +26,8 @@ Configuration for [Liquid Web](https://liquidweb.com).
 Here is an example bash command using the Liquid Web provider:
 
 ```bash
-LIQUID_WEB_USERNAME=someuser \
-LIQUID_WEB_PASSWORD=somepass \
+LWAPI_USERNAME=someuser \
+LWAPI_PASSWORD=somepass \
 lego --email you@example.com --dns liquidweb --domains my.example.org run
 ```
 
@@ -38,8 +38,8 @@ lego --email you@example.com --dns liquidweb --domains my.example.org run
 
 | Environment Variable Name | Description |
 |-----------------------|-------------|
-| `LIQUID_WEB_PASSWORD` | Liquid Web API Password |
-| `LIQUID_WEB_USERNAME` | Liquid Web API Username |
+| `LWAPI_PASSWORD` | Liquid Web API Password |
+| `LWAPI_USERNAME` | Liquid Web API Username |
 
 The environment variable names can be suffixed by `_FILE` to reference a file instead of a value.
 More information [here]({{< ref "dns#configuration-and-credentials" >}}).
@@ -49,12 +49,12 @@ More information [here]({{< ref "dns#configuration-and-credentials" >}}).
 
 | Environment Variable Name | Description |
 |--------------------------------|-------------|
-| `LIQUID_WEB_HTTP_TIMEOUT` | Maximum waiting time for the DNS records to be created (not verified) |
-| `LIQUID_WEB_POLLING_INTERVAL` | Time between DNS propagation check |
-| `LIQUID_WEB_PROPAGATION_TIMEOUT` | Maximum waiting time for DNS propagation |
-| `LIQUID_WEB_TTL` | The TTL of the TXT record used for the DNS challenge |
-| `LIQUID_WEB_URL` | Liquid Web API endpoint |
-| `LIQUID_WEB_ZONE` | DNS Zone |
+| `LWAPI_HTTP_TIMEOUT` | Maximum waiting time for the DNS records to be created (not verified) |
+| `LWAPI_POLLING_INTERVAL` | Time between DNS propagation check |
+| `LWAPI_PROPAGATION_TIMEOUT` | Maximum waiting time for DNS propagation |
+| `LWAPI_TTL` | The TTL of the TXT record used for the DNS challenge |
+| `LWAPI_URL` | Liquid Web API endpoint |
+| `LWAPI_ZONE` | DNS Zone |
 
 The environment variable names can be suffixed by `_FILE` to reference a file instead of a value.
 More information [here]({{< ref "dns#configuration-and-credentials" >}}).
diff --git a/providers/dns/acmedns/acmedns.go b/providers/dns/acmedns/acmedns.go
index 503e80c2..b7ec3165 100644
--- a/providers/dns/acmedns/acmedns.go
+++ b/providers/dns/acmedns/acmedns.go
@@ -28,10 +28,10 @@ const (
 type acmeDNSClient interface {
 	// UpdateTXTRecord updates the provided account's TXT record
 	// to the given value or returns an error.
-	UpdateTXTRecord(goacmedns.Account, string) error
+	UpdateTXTRecord(account goacmedns.Account, value string) error
 	// RegisterAccount registers and returns a new account
 	// with the given allowFrom restriction or returns an error.
-	RegisterAccount([]string) (goacmedns.Account, error)
+	RegisterAccount(allowFrom []string) (goacmedns.Account, error)
 }
 
 // DNSProvider implements the challenge.Provider interface.
diff --git a/providers/dns/brandit/internal/client.go b/providers/dns/brandit/internal/client.go
index 12e28fdf..cba8eefc 100644
--- a/providers/dns/brandit/internal/client.go
+++ b/providers/dns/brandit/internal/client.go
@@ -11,6 +11,7 @@ import (
 	"io"
 	"net/http"
 	"net/url"
+	"strconv"
 	"strings"
 	"time"
 
@@ -58,7 +59,7 @@ func (c *Client) ListRecords(ctx context.Context, account, dnsZone string) (*Lis
 	}
 
 	for len(result.Response.RR) < result.Response.Total[0] {
-		query.Add("first", fmt.Sprint(result.Response.Last[0]+1))
+		query.Add("first", strconv.Itoa(result.Response.Last[0]+1))
 
 		tmp := &Response[*ListRecordsResponse]{}
 		err := c.do(ctx, query, tmp)
@@ -76,7 +77,7 @@ func (c *Client) ListRecords(ctx context.Context, account, dnsZone string) (*Lis
 // AddRecord adds a DNS record.
 // https://portal.brandit.com/apidocv3#addDNSRR
 func (c *Client) AddRecord(ctx context.Context, domainName, account, newRecordID string, record Record) (*AddRecord, error) {
-	value := strings.Join([]string{record.Name, fmt.Sprint(record.TTL), "IN", record.Type, record.Content}, " ")
+	value := strings.Join([]string{record.Name, strconv.Itoa(record.TTL), "IN", record.Type, record.Content}, " ")
 
 	query := url.Values{}
 	query.Add("command", "addDNSRR")
diff --git a/providers/dns/namecheap/internal/client.go b/providers/dns/namecheap/internal/client.go
index f2124f83..f7ca8f66 100644
--- a/providers/dns/namecheap/internal/client.go
+++ b/providers/dns/namecheap/internal/client.go
@@ -8,6 +8,7 @@ import (
 	"io"
 	"net/http"
 	"net/url"
+	"strconv"
 	"strings"
 	"time"
 
@@ -73,7 +74,7 @@ func (c *Client) SetHosts(ctx context.Context, sld, tld string, hosts []Record)
 		addParam("TLD", tld),
 		func(values url.Values) {
 			for i, h := range hosts {
-				ind := fmt.Sprintf("%d", i+1)
+				ind := strconv.Itoa(i + 1)
 				values.Add("HostName"+ind, h.Name)
 				values.Add("RecordType"+ind, h.Type)
 				values.Add("Address"+ind, h.Address)
diff --git a/providers/dns/otc/internal/mock.go b/providers/dns/otc/internal/mock.go
index 33cb0728..2ed7f84d 100644
--- a/providers/dns/otc/internal/mock.go
+++ b/providers/dns/otc/internal/mock.go
@@ -10,6 +10,7 @@ import (
 	"testing"
 
 	"github.com/stretchr/testify/assert"
+	"github.com/stretchr/testify/require"
 )
 
 const fakeOTCToken = "62244bc21da68d03ebac94e6636ff01f"
@@ -143,7 +144,7 @@ func (m *DNSServerMock) HandleListRecordsetsSuccessfully() {
 			assert.Equal(m.t, "application/json", r.Header.Get("Content-Type"))
 
 			raw, err := io.ReadAll(r.Body)
-			assert.Nil(m.t, err)
+			require.NoError(m.t, err)
 			exceptedString := `{
 				"name": "_acme-challenge.example.com.",
 				"description": "Added TXT record for ACME dns-01 challenge using lego client",
diff --git a/providers/dns/simply/internal/client.go b/providers/dns/simply/internal/client.go
index f4221194..b57bf210 100644
--- a/providers/dns/simply/internal/client.go
+++ b/providers/dns/simply/internal/client.go
@@ -9,6 +9,7 @@ import (
 	"io"
 	"net/http"
 	"net/url"
+	"strconv"
 	"strings"
 	"time"
 
@@ -87,7 +88,7 @@ func (c *Client) AddRecord(ctx context.Context, zoneName string, record Record)
 
 // EditRecord updates a record.
 func (c *Client) EditRecord(ctx context.Context, zoneName string, id int64, record Record) error {
-	endpoint := c.createEndpoint(zoneName, fmt.Sprintf("%d", id))
+	endpoint := c.createEndpoint(zoneName, strconv.FormatInt(id, 10))
 
 	req, err := newJSONRequest(ctx, http.MethodPut, endpoint, record)
 	if err != nil {
@@ -99,7 +100,7 @@ func (c *Client) EditRecord(ctx context.Context, zoneName string, id int64, reco
 
 // DeleteRecord deletes a record.
 func (c *Client) DeleteRecord(ctx context.Context, zoneName string, id int64) error {
-	endpoint := c.createEndpoint(zoneName, fmt.Sprintf("%d", id))
+	endpoint := c.createEndpoint(zoneName, strconv.FormatInt(id, 10))
 
 	req, err := newJSONRequest(ctx, http.MethodDelete, endpoint, nil)
 	if err != nil {
diff --git a/providers/dns/wedos/internal/token.go b/providers/dns/wedos/internal/token.go
index bca3f10f..b83b107c 100644
--- a/providers/dns/wedos/internal/token.go
+++ b/providers/dns/wedos/internal/token.go
@@ -2,6 +2,7 @@ package internal
 
 import (
 	"crypto/sha1"
+	"encoding/hex"
 	"fmt"
 	"io"
 	"time"
@@ -14,7 +15,7 @@ func authToken(userName string, wapiPass string) string {
 func sha1string(txt string) string {
 	h := sha1.New()
 	_, _ = io.WriteString(h, txt)
-	return fmt.Sprintf("%x", h.Sum(nil))
+	return hex.EncodeToString(h.Sum(nil))
 }
 
 func czechHourString() string {
diff --git a/providers/dns/yandexcloud/yandexcloud.go b/providers/dns/yandexcloud/yandexcloud.go
index f30aef76..97c003af 100644
--- a/providers/dns/yandexcloud/yandexcloud.go
+++ b/providers/dns/yandexcloud/yandexcloud.go
@@ -197,7 +197,7 @@ func (r *DNSProvider) getZones(ctx context.Context) ([]*ycdns.DnsZone, error) {
 		return nil, errors.New("unable to fetch dns zones")
 	}
 
-	return response.DnsZones, nil
+	return response.GetDnsZones(), nil
 }
 
 func (r *DNSProvider) upsertRecordSetData(ctx context.Context, zoneID, name, value string) error {
@@ -223,7 +223,7 @@ func (r *DNSProvider) upsertRecordSetData(ctx context.Context, zoneID, name, val
 
 	var deletions []*ycdns.RecordSet
 	if exist != nil {
-		record.Data = append(record.Data, exist.Data...)
+		record.SetData(append(record.GetData(), exist.GetData()...))
 		deletions = append(deletions, exist)
 	}
 
@@ -263,7 +263,7 @@ func (r *DNSProvider) removeRecordSetData(ctx context.Context, zoneID, name, val
 
 	var additions []*ycdns.RecordSet
 
-	if len(previousRecord.Data) > 1 {
+	if len(previousRecord.GetData()) > 1 {
 		// RecordSet is not empty we should update it
 		record := &ycdns.RecordSet{
 			Name: name,
@@ -272,9 +272,9 @@ func (r *DNSProvider) removeRecordSetData(ctx context.Context, zoneID, name, val
 			Data: []string{},
 		}
 
-		for _, data := range previousRecord.Data {
+		for _, data := range previousRecord.GetData() {
 			if data != value {
-				record.Data = append(record.Data, data)
+				record.SetData(append(record.GetData(), data))
 			}
 		}
 
@@ -309,13 +309,13 @@ func decodeCredentials(accountB64 string) (ycsdk.Credentials, error) {
 }
 
 func appendRecordSetData(record *ycdns.RecordSet, value string) bool {
-	for _, data := range record.Data {
+	for _, data := range record.GetData() {
 		if data == value {
 			return false
 		}
 	}
 
-	record.Data = append(record.Data, value)
+	record.SetData(append(record.GetData(), value))
 
 	return true
 }
diff --git a/registration/registar.go b/registration/registar.go
index 76920818..78e0ce7d 100644
--- a/registration/registar.go
+++ b/registration/registar.go
@@ -9,6 +9,8 @@ import (
 	"github.com/go-acme/lego/v4/log"
 )
 
+const mailTo = "mailto:"
+
 // Resource represents all important information about a registration
 // of which the client needs to keep track itself.
 // WARNING: will be removed in the future (acme.ExtendedAccount), https://github.com/go-acme/lego/issues/855.
@@ -52,7 +54,7 @@ func (r *Registrar) Register(options RegisterOptions) (*Resource, error) {
 
 	if r.user.GetEmail() != "" {
 		log.Infof("acme: Registering account for %s", r.user.GetEmail())
-		accMsg.Contact = []string{"mailto:" + r.user.GetEmail()}
+		accMsg.Contact = []string{mailTo + r.user.GetEmail()}
 	}
 
 	account, err := r.core.Accounts.New(accMsg)
@@ -76,7 +78,7 @@ func (r *Registrar) RegisterWithExternalAccountBinding(options RegisterEABOption
 
 	if r.user.GetEmail() != "" {
 		log.Infof("acme: Registering account for %s", r.user.GetEmail())
-		accMsg.Contact = []string{"mailto:" + r.user.GetEmail()}
+		accMsg.Contact = []string{mailTo + r.user.GetEmail()}
 	}
 
 	account, err := r.core.Accounts.NewEAB(accMsg, options.Kid, options.HmacEncoded)
@@ -128,7 +130,7 @@ func (r *Registrar) UpdateRegistration(options RegisterOptions) (*Resource, erro
 
 	if r.user.GetEmail() != "" {
 		log.Infof("acme: Registering account for %s", r.user.GetEmail())
-		accMsg.Contact = []string{"mailto:" + r.user.GetEmail()}
+		accMsg.Contact = []string{mailTo + r.user.GetEmail()}
 	}
 
 	accountURL := r.user.GetRegistration().URI


Test patch:
diff --git a/certificate/errors_test.go b/certificate/errors_test.go
index b4866462..d18b1219 100644
--- a/certificate/errors_test.go
+++ b/certificate/errors_test.go
@@ -4,7 +4,6 @@ import (
 	"errors"
 	"testing"
 
-	"github.com/stretchr/testify/assert"
 	"github.com/stretchr/testify/require"
 )
 
@@ -28,7 +27,7 @@ func Test_obtainError_Join(t *testing.T) {
 	err := failures.Join()
 
 	to := &TomatoError{}
-	assert.ErrorAs(t, err, &to)
+	require.ErrorAs(t, err, &to)
 }
 
 func Test_obtainError_Join_multiple_domains(t *testing.T) {
@@ -40,16 +39,16 @@ func Test_obtainError_Join_multiple_domains(t *testing.T) {
 	err := failures.Join()
 
 	to := &TomatoError{}
-	assert.ErrorAs(t, err, &to)
+	require.ErrorAs(t, err, &to)
 
 	ca := &CarrotError{}
-	assert.ErrorAs(t, err, &ca)
+	require.ErrorAs(t, err, &ca)
 }
 
 func Test_obtainError_Join_no_error(t *testing.T) {
 	failures := newObtainError()
 
-	assert.NoError(t, failures.Join())
+	require.NoError(t, failures.Join())
 }
 
 func Test_obtainError_Join_same_domain(t *testing.T) {
@@ -66,5 +65,5 @@ func Test_obtainError_Join_same_domain(t *testing.T) {
 	}
 
 	ca := &CarrotError{}
-	assert.ErrorAs(t, err, &ca)
+	require.ErrorAs(t, err, &ca)
 }
diff --git a/challenge/dns01/dns_challenge_manual_test.go b/challenge/dns01/dns_challenge_manual_test.go
index 1cd5b54a..cfc728ac 100644
--- a/challenge/dns01/dns_challenge_manual_test.go
+++ b/challenge/dns01/dns_challenge_manual_test.go
@@ -5,7 +5,6 @@ import (
 	"os"
 	"testing"
 
-	"github.com/stretchr/testify/assert"
 	"github.com/stretchr/testify/require"
 )
 
@@ -32,14 +31,14 @@ func TestDNSProviderManual(t *testing.T) {
 	for _, test := range testCases {
 		t.Run(test.desc, func(t *testing.T) {
 			file, err := os.CreateTemp("", "lego_test")
-			assert.NoError(t, err)
+			require.NoError(t, err)
 			defer func() { _ = os.Remove(file.Name()) }()
 
 			_, err = file.WriteString(test.input)
-			assert.NoError(t, err)
+			require.NoError(t, err)
 
 			_, err = file.Seek(0, io.SeekStart)
-			assert.NoError(t, err)
+			require.NoError(t, err)
 
 			os.Stdin = file
 
diff --git a/challenge/tlsalpn01/tls_alpn_challenge_test.go b/challenge/tlsalpn01/tls_alpn_challenge_test.go
index 75953e97..493d9ca6 100644
--- a/challenge/tlsalpn01/tls_alpn_challenge_test.go
+++ b/challenge/tlsalpn01/tls_alpn_challenge_test.go
@@ -141,7 +141,7 @@ func TestChallengeIPaddress(t *testing.T) {
 		assert.Len(t, connState.PeerCertificates, 1, "Expected the challenge server to return exactly one certificate")
 
 		remoteCert := connState.PeerCertificates[0]
-		assert.Len(t, remoteCert.DNSNames, 0, "Expected the challenge certificate to have no DNSNames entry in context of challenge for IP")
+		assert.Empty(t, remoteCert.DNSNames, "Expected the challenge certificate to have no DNSNames entry in context of challenge for IP")
 		assert.Len(t, remoteCert.IPAddresses, 1, "Expected the challenge certificate to have exactly one IPAddresses entry")
 		assert.True(t, net.ParseIP("127.0.0.1").Equal(remoteCert.IPAddresses[0]), "challenge certificate IPAddress ")
 		assert.NotEmpty(t, remoteCert.Extensions, "Expected the challenge certificate to contain extensions")
diff --git a/providers/dns/autodns/autodns_test.go b/providers/dns/autodns/autodns_test.go
index 900efbdf..bc9f3067 100644
--- a/providers/dns/autodns/autodns_test.go
+++ b/providers/dns/autodns/autodns_test.go
@@ -4,7 +4,6 @@ import (
 	"testing"
 
 	"github.com/go-acme/lego/v4/platform/tester"
-	"github.com/stretchr/testify/assert"
 	"github.com/stretchr/testify/require"
 )
 
@@ -133,10 +132,10 @@ func TestLivePresent(t *testing.T) {
 
 	envTest.RestoreEnv()
 	provider, err := NewDNSProvider()
-	assert.NoError(t, err)
+	require.NoError(t, err)
 
 	err = provider.Present(envTest.GetDomain(), "", "123d==")
-	assert.NoError(t, err)
+	require.NoError(t, err)
 }
 
 func TestLiveCleanUp(t *testing.T) {
@@ -146,8 +145,8 @@ func TestLiveCleanUp(t *testing.T) {
 
 	envTest.RestoreEnv()
 	provider, err := NewDNSProvider()
-	assert.NoError(t, err)
+	require.NoError(t, err)
 
 	err = provider.CleanUp(envTest.GetDomain(), "", "123d==")
-	assert.NoError(t, err)
+	require.NoError(t, err)
 }
diff --git a/providers/dns/checkdomain/checkdomain_test.go b/providers/dns/checkdomain/checkdomain_test.go
index b94f9397..d9d0b62a 100644
--- a/providers/dns/checkdomain/checkdomain_test.go
+++ b/providers/dns/checkdomain/checkdomain_test.go
@@ -6,7 +6,6 @@ import (
 
 	"github.com/go-acme/lego/v4/platform/tester"
 	"github.com/go-acme/lego/v4/providers/dns/checkdomain/internal"
-	"github.com/stretchr/testify/assert"
 	"github.com/stretchr/testify/require"
 )
 
@@ -110,10 +109,10 @@ func TestLivePresent(t *testing.T) {
 
 	envTest.RestoreEnv()
 	provider, err := NewDNSProvider()
-	assert.NoError(t, err)
+	require.NoError(t, err)
 
 	err = provider.Present(envTest.GetDomain(), "", "123d==")
-	assert.NoError(t, err)
+	require.NoError(t, err)
 }
 
 func TestLiveCleanUp(t *testing.T) {
@@ -123,8 +122,8 @@ func TestLiveCleanUp(t *testing.T) {
 
 	envTest.RestoreEnv()
 	provider, err := NewDNSProvider()
-	assert.NoError(t, err)
+	require.NoError(t, err)
 
 	err = provider.CleanUp(envTest.GetDomain(), "", "123d==")
-	assert.NoError(t, err)
+	require.NoError(t, err)
 }
diff --git a/providers/dns/dns_providers_test.go b/providers/dns/dns_providers_test.go
index 1c005d53..1f39e2bd 100644
--- a/providers/dns/dns_providers_test.go
+++ b/providers/dns/dns_providers_test.go
@@ -29,12 +29,12 @@ func TestKnownDNSProviderError(t *testing.T) {
 	envTest.ClearEnv()
 
 	provider, err := NewDNSChallengeProviderByName("exec")
-	assert.Error(t, err)
+	require.Error(t, err)
 	assert.Nil(t, provider)
 }
 
 func TestUnknownDNSProvider(t *testing.T) {
 	provider, err := NewDNSChallengeProviderByName("foobar")
-	assert.Error(t, err)
+	require.Error(t, err)
 	assert.Nil(t, provider)
 }
diff --git a/providers/dns/dreamhost/dreamhost_test.go b/providers/dns/dreamhost/dreamhost_test.go
index 796d4fe5..0f91ffae 100644
--- a/providers/dns/dreamhost/dreamhost_test.go
+++ b/providers/dns/dreamhost/dreamhost_test.go
@@ -121,12 +121,12 @@ func TestDNSProvider_Present(t *testing.T) {
 		assert.Equal(t, http.MethodGet, r.Method, "method")
 
 		q := r.URL.Query()
-		assert.Equal(t, q.Get("key"), fakeAPIKey)
-		assert.Equal(t, q.Get("cmd"), "dns-add_record")
-		assert.Equal(t, q.Get("format"), "json")
-		assert.Equal(t, q.Get("record"), "_acme-challenge.example.com")
-		assert.Equal(t, q.Get("value"), fakeKeyAuth)
-		assert.Equal(t, q.Get("comment"), "Managed+By+lego")
+		assert.Equal(t, fakeAPIKey, q.Get("key"))
+		assert.Equal(t, "dns-add_record", q.Get("cmd"))
+		assert.Equal(t, "json", q.Get("format"))
+		assert.Equal(t, "_acme-challenge.example.com", q.Get("record"))
+		assert.Equal(t, fakeKeyAuth, q.Get("value"))
+		assert.Equal(t, "Managed+By+lego", q.Get("comment"))
 
 		_, err := fmt.Fprintf(w, `{"data":"record_added","result":"success"}`)
 		if err != nil {
@@ -163,12 +163,12 @@ func TestDNSProvider_Cleanup(t *testing.T) {
 		assert.Equal(t, http.MethodGet, r.Method, "method")
 
 		q := r.URL.Query()
-		assert.Equal(t, q.Get("key"), fakeAPIKey, "key mismatch")
-		assert.Equal(t, q.Get("cmd"), "dns-remove_record", "cmd mismatch")
-		assert.Equal(t, q.Get("format"), "json")
-		assert.Equal(t, q.Get("record"), "_acme-challenge.example.com")
-		assert.Equal(t, q.Get("value"), fakeKeyAuth, "value mismatch")
-		assert.Equal(t, q.Get("comment"), "Managed+By+lego")
+		assert.Equal(t, fakeAPIKey, q.Get("key"), "key mismatch")
+		assert.Equal(t, "dns-remove_record", q.Get("cmd"), "cmd mismatch")
+		assert.Equal(t, "json", q.Get("format"))
+		assert.Equal(t, "_acme-challenge.example.com", q.Get("record"))
+		assert.Equal(t, fakeKeyAuth, q.Get("value"), "value mismatch")
+		assert.Equal(t, "Managed+By+lego", q.Get("comment"))
 
 		_, err := fmt.Fprintf(w, `{"data":"record_removed","result":"success"}`)
 		if err != nil {
diff --git a/providers/dns/edgedns/edgedns_integration_test.go b/providers/dns/edgedns/edgedns_integration_test.go
index c4044d1e..e1b3bb7c 100644
--- a/providers/dns/edgedns/edgedns_integration_test.go
+++ b/providers/dns/edgedns/edgedns_integration_test.go
@@ -78,9 +78,9 @@ func TestLiveTTL(t *testing.T) {
 		}
 
 		t.Run(fmt.Sprintf("testing record set %d", i), func(t *testing.T) {
-			assert.Equal(t, rrset.Name, fqdn)
-			assert.Equal(t, rrset.Type, "TXT")
-			assert.Equal(t, rrset.TTL, dns01.DefaultTTL)
+			assert.Equal(t, fqdn, rrset.Name)
+			assert.Equal(t, "TXT", rrset.Type)
+			assert.Equal(t, dns01.DefaultTTL, rrset.TTL)
 		})
 	}
 }
diff --git a/providers/dns/epik/internal/client_test.go b/providers/dns/epik/internal/client_test.go
index a1d0186a..78c4452f 100644
--- a/providers/dns/epik/internal/client_test.go
+++ b/providers/dns/epik/internal/client_test.go
@@ -94,7 +94,7 @@ func TestClient_GetDNSRecords_error(t *testing.T) {
 	mux.HandleFunc("/domains/example.com/records", testHandler(http.MethodGet, http.StatusUnauthorized, "error.json"))
 
 	_, err := client.GetDNSRecords(context.Background(), "example.com")
-	assert.Error(t, err)
+	require.Error(t, err)
 }
 
 func TestClient_CreateHostRecord(t *testing.T) {
@@ -135,7 +135,7 @@ func TestClient_CreateHostRecord_error(t *testing.T) {
 	}
 
 	_, err := client.CreateHostRecord(context.Background(), "example.com", record)
-	assert.Error(t, err)
+	require.Error(t, err)
 }
 
 func TestClient_RemoveHostRecord(t *testing.T) {
@@ -160,7 +160,7 @@ func TestClient_RemoveHostRecord_error(t *testing.T) {
 	mux.HandleFunc("/domains/example.com/records", testHandler(http.MethodDelete, http.StatusUnauthorized, "error.json"))
 
 	_, err := client.RemoveHostRecord(context.Background(), "example.com", "abc123")
-	assert.Error(t, err)
+	require.Error(t, err)
 }
 
 func testHandler(method string, statusCode int, filename string) http.HandlerFunc {
diff --git a/providers/dns/gcloud/googlecloud_test.go b/providers/dns/gcloud/googlecloud_test.go
index 02071b1c..453fdd5e 100644
--- a/providers/dns/gcloud/googlecloud_test.go
+++ b/providers/dns/gcloud/googlecloud_test.go
@@ -391,7 +391,6 @@ func TestLivePresent(t *testing.T) {
 	}
 
 	envTest.RestoreEnv()
-
 	provider, err := NewDNSProviderCredentials(envTest.GetValue(EnvProject))
 	require.NoError(t, err)
 
diff --git a/providers/dns/internal/selectel/client_test.go b/providers/dns/internal/selectel/client_test.go
index fd658ae3..703fd7b9 100644
--- a/providers/dns/internal/selectel/client_test.go
+++ b/providers/dns/internal/selectel/client_test.go
@@ -78,7 +78,7 @@ func TestClient_ListRecords_error(t *testing.T) {
 
 	records, err := client.ListRecords(context.Background(), 123)
 
-	assert.EqualError(t, err, "request failed with status code 401: API error: 400 - error description - field that the error occurred in")
+	require.EqualError(t, err, "request failed with status code 401: API error: 400 - error description - field that the error occurred in")
 	assert.Nil(t, records)
 }
 
diff --git a/providers/dns/joker/internal/dmapi/client_test.go b/providers/dns/joker/internal/dmapi/client_test.go
index 7bdb07ed..a1240b7c 100644
--- a/providers/dns/joker/internal/dmapi/client_test.go
+++ b/providers/dns/joker/internal/dmapi/client_test.go
@@ -226,8 +226,8 @@ func Test_RemoveTxtEntryFromZone(t *testing.T) {
 			t.Parallel()
 
 			zone, modified := RemoveTxtEntryFromZone(test.input, "_acme-challenge")
-			assert.Equal(t, zone, test.expected)
-			assert.Equal(t, modified, test.modified)
+			assert.Equal(t, test.expected, zone)
+			assert.Equal(t, test.modified, modified)
 		})
 	}
 }
@@ -258,7 +258,7 @@ func Test_AddTxtEntryToZone(t *testing.T) {
 	for _, test := range testCases {
 		t.Run(test.desc, func(t *testing.T) {
 			zone := AddTxtEntryToZone(test.input, "_acme-challenge", "test", 120)
-			assert.Equal(t, zone, test.expected)
+			assert.Equal(t, test.expected, zone)
 		})
 	}
 }
@@ -299,7 +299,7 @@ func Test_fixTxtLines(t *testing.T) {
 	for _, test := range testCases {
 		t.Run(test.desc, func(t *testing.T) {
 			line := fixTxtLines(test.input)
-			assert.Equal(t, line, test.expected)
+			assert.Equal(t, test.expected, line)
 		})
 	}
 }
diff --git a/providers/dns/liquidweb/liquidweb_test.go b/providers/dns/liquidweb/liquidweb_test.go
index 47461edd..c62ff65f 100644
--- a/providers/dns/liquidweb/liquidweb_test.go
+++ b/providers/dns/liquidweb/liquidweb_test.go
@@ -265,7 +265,6 @@ func TestLivePresent(t *testing.T) {
 	}
 
 	envTest.RestoreEnv()
-
 	provider, err := NewDNSProvider()
 	require.NoError(t, err)
 
diff --git a/providers/dns/loopia/internal/client_test.go b/providers/dns/loopia/internal/client_test.go
index e62fc2b6..4fe2e1fd 100644
--- a/providers/dns/loopia/internal/client_test.go
+++ b/providers/dns/loopia/internal/client_test.go
@@ -239,7 +239,7 @@ func TestClient_rpcCall_404(t *testing.T) {
 	client.BaseURL = server.URL + "/"
 
 	err := client.rpcCall(context.Background(), call, &responseString{})
-	assert.EqualError(t, err, "unexpected status code: [status code: 404] body: <?xml version='1.0' encoding='UTF-8'?>")
+	require.EqualError(t, err, "unexpected status code: [status code: 404] body: <?xml version='1.0' encoding='UTF-8'?>")
 }
 
 func TestClient_rpcCall_RPCError(t *testing.T) {
@@ -270,7 +270,7 @@ func TestClient_rpcCall_RPCError(t *testing.T) {
 	client.BaseURL = server.URL + "/"
 
 	err := client.rpcCall(context.Background(), call, &responseString{})
-	assert.EqualError(t, err, "RPC Error: (201) Method signature error: 42")
+	require.EqualError(t, err, "RPC Error: (201) Method signature error: 42")
 }
 
 func TestUnmarshallFaultyRecordObject(t *testing.T) {
diff --git a/providers/dns/mydnsjp/mydnsjp_test.go b/providers/dns/mydnsjp/mydnsjp_test.go
index 71a28fef..96eb9586 100644
--- a/providers/dns/mydnsjp/mydnsjp_test.go
+++ b/providers/dns/mydnsjp/mydnsjp_test.go
@@ -128,7 +128,7 @@ func TestLivePresent(t *testing.T) {
 	require.NoError(t, err)
 
 	err = provider.Present(envTest.GetDomain(), "", "123d==")
-	assert.NoError(t, err)
+	require.NoError(t, err)
 }
 
 func TestLiveCleanUp(t *testing.T) {
@@ -143,5 +143,5 @@ func TestLiveCleanUp(t *testing.T) {
 	time.Sleep(2 * time.Second)
 
 	err = provider.CleanUp(envTest.GetDomain(), "", "123d==")
-	assert.NoError(t, err)
+	require.NoError(t, err)
 }
diff --git a/providers/dns/namesilo/namesilo_test.go b/providers/dns/namesilo/namesilo_test.go
index 07244479..4b01d738 100644
--- a/providers/dns/namesilo/namesilo_test.go
+++ b/providers/dns/namesilo/namesilo_test.go
@@ -112,7 +112,6 @@ func TestLivePresent(t *testing.T) {
 	}
 
 	envTest.RestoreEnv()
-
 	provider, err := NewDNSProvider()
 	require.NoError(t, err)
 
diff --git a/providers/dns/netcup/internal/client_test.go b/providers/dns/netcup/internal/client_test.go
index 80923fee..25d49436 100644
--- a/providers/dns/netcup/internal/client_test.go
+++ b/providers/dns/netcup/internal/client_test.go
@@ -356,7 +356,7 @@ func TestClient_UpdateDNSRecord_Live(t *testing.T) {
 	info := dns01.GetChallengeInfo(envTest.GetDomain(), "123d==")
 
 	zone, err := dns01.FindZoneByFqdn(info.EffectiveFQDN)
-	require.NoError(t, err, fmt.Errorf("error finding DNSZone, %w", err))
+	require.NotErrorIs(t, err, fmt.Errorf("error finding DNSZone, %w", err))
 
 	hostname := strings.Replace(info.EffectiveFQDN, "."+zone, "", 1)
 
diff --git a/providers/dns/otc/otc_test.go b/providers/dns/otc/otc_test.go
index 3edfca8b..54907b69 100644
--- a/providers/dns/otc/otc_test.go
+++ b/providers/dns/otc/otc_test.go
@@ -63,18 +63,18 @@ func (s *OTCSuite) TestLoginEnv() {
 	provider, err := NewDNSProvider()
 	s.Require().NoError(err)
 
-	s.Equal(provider.config.DomainName, "unittest1")
-	s.Equal(provider.config.UserName, "unittest2")
-	s.Equal(provider.config.Password, "unittest3")
-	s.Equal(provider.config.ProjectName, "unittest4")
-	s.Equal(provider.config.IdentityEndpoint, "unittest5")
+	s.Equal("unittest1", provider.config.DomainName)
+	s.Equal("unittest2", provider.config.UserName)
+	s.Equal("unittest3", provider.config.Password)
+	s.Equal("unittest4", provider.config.ProjectName)
+	s.Equal("unittest5", provider.config.IdentityEndpoint)
 
 	os.Setenv(EnvIdentityEndpoint, "")
 
 	provider, err = NewDNSProvider()
 	s.Require().NoError(err)
 
-	s.Equal(provider.config.IdentityEndpoint, "https://iam.eu-de.otc.t-systems.com:443/v3/auth/tokens")
+	s.Equal("https://iam.eu-de.otc.t-systems.com:443/v3/auth/tokens", provider.config.IdentityEndpoint)
 }
 
 func (s *OTCSuite) TestLoginEnvEmpty() {
@@ -103,7 +103,7 @@ func (s *OTCSuite) TestDNSProvider_Present_EmptyZone() {
 	s.Require().NoError(err)
 
 	err = provider.Present("example.com", "", "foobar")
-	s.NotNil(err)
+	s.Error(err)
 }
 
 func (s *OTCSuite) TestDNSProvider_CleanUp() {
diff --git a/providers/dns/rackspace/rackspace_test.go b/providers/dns/rackspace/rackspace_test.go
index 1e120e09..cbc57b47 100644
--- a/providers/dns/rackspace/rackspace_test.go
+++ b/providers/dns/rackspace/rackspace_test.go
@@ -29,12 +29,12 @@ func TestNewDNSProviderConfig(t *testing.T) {
 	require.NoError(t, err)
 	assert.NotNil(t, provider.config)
 
-	assert.Equal(t, provider.token, "testToken", "The token should match")
+	assert.Equal(t, "testToken", provider.token, "The token should match")
 }
 
 func TestNewDNSProviderConfig_MissingCredErr(t *testing.T) {
 	_, err := NewDNSProviderConfig(NewDefaultConfig())
-	assert.EqualError(t, err, "rackspace: credentials missing")
+	require.EqualError(t, err, "rackspace: credentials missing")
 }
 
 func TestDNSProvider_Present(t *testing.T) {
diff --git a/providers/dns/sakuracloud/wrapper_test.go b/providers/dns/sakuracloud/wrapper_test.go
index e9c7bc64..59f9e24a 100644
--- a/providers/dns/sakuracloud/wrapper_test.go
+++ b/providers/dns/sakuracloud/wrapper_test.go
@@ -83,7 +83,7 @@ func TestDNSProvider_addAndCleanupRecords(t *testing.T) {
 		require.NoError(t, e)
 		require.NotNil(t, updZone)
 
-		require.Len(t, updZone.Records, 0)
+		require.Empty(t, updZone.Records)
 	})
 }
 
@@ -143,6 +143,6 @@ func TestDNSProvider_concurrentAddAndCleanupRecords(t *testing.T) {
 		require.NoError(t, err)
 		require.NotNil(t, updZone)
 
-		require.Len(t, updZone.Records, 0)
+		require.Empty(t, updZone.Records)
 	})
 }
diff --git a/providers/dns/sonic/sonic_test.go b/providers/dns/sonic/sonic_test.go
index 41923271..f9087f8e 100644
--- a/providers/dns/sonic/sonic_test.go
+++ b/providers/dns/sonic/sonic_test.go
@@ -4,7 +4,6 @@ import (
 	"testing"
 
 	"github.com/go-acme/lego/v4/platform/tester"
-	"github.com/stretchr/testify/assert"
 	"github.com/stretchr/testify/require"
 )
 
@@ -121,10 +120,10 @@ func TestLivePresent(t *testing.T) {
 
 	envTest.RestoreEnv()
 	provider, err := NewDNSProvider()
-	assert.NoError(t, err)
+	require.NoError(t, err)
 
 	err = provider.Present(envTest.GetDomain(), "", "123d==")
-	assert.NoError(t, err)
+	require.NoError(t, err)
 }
 
 func TestLiveCleanUp(t *testing.T) {
@@ -134,8 +133,8 @@ func TestLiveCleanUp(t *testing.T) {
 
 	envTest.RestoreEnv()
 	provider, err := NewDNSProvider()
-	assert.NoError(t, err)
+	require.NoError(t, err)
 
 	err = provider.CleanUp(envTest.GetDomain(), "", "123d==")
-	assert.NoError(t, err)
+	require.NoError(t, err)
 }
diff --git a/providers/dns/transip/transip_test.go b/providers/dns/transip/transip_test.go
index a09cafe8..05d70158 100644
--- a/providers/dns/transip/transip_test.go
+++ b/providers/dns/transip/transip_test.go
@@ -92,7 +92,7 @@ func TestNewDNSProvider(t *testing.T) {
 		})
 
 		_, err := NewDNSProvider()
-		assert.ErrorIs(t, err, os.ErrNotExist)
+		require.ErrorIs(t, err, os.ErrNotExist)
 	})
 }
 
@@ -151,7 +151,7 @@ func TestNewDNSProviderConfig(t *testing.T) {
 		config.PrivateKeyPath = "./fixtures/non/existent/private.key"
 
 		_, err := NewDNSProviderConfig(config)
-		assert.ErrorIs(t, err, os.ErrNotExist)
+		require.ErrorIs(t, err, os.ErrNotExist)
 	})
 }
 
diff --git a/providers/dns/ultradns/ultradns_test.go b/providers/dns/ultradns/ultradns_test.go
index 08a3b6aa..e07b6a52 100644
--- a/providers/dns/ultradns/ultradns_test.go
+++ b/providers/dns/ultradns/ultradns_test.go
@@ -175,7 +175,6 @@ func TestLivePresent(t *testing.T) {
 	}
 
 	envTest.RestoreEnv()
-
 	provider, err := NewDNSProvider()
 	require.NoError(t, err)
 
diff --git a/providers/dns/vegadns/vegadns_test.go b/providers/dns/vegadns/vegadns_test.go
index 4e82da45..60f614c3 100644
--- a/providers/dns/vegadns/vegadns_test.go
+++ b/providers/dns/vegadns/vegadns_test.go
@@ -21,7 +21,7 @@ func TestNewDNSProvider_Fail(t *testing.T) {
 	envTest.ClearEnv()
 
 	_, err := NewDNSProvider()
-	assert.Error(t, err, "VEGADNS_URL env missing")
+	require.Error(t, err, "VEGADNS_URL env missing")
 }
 
 func TestDNSProvider_TimeoutSuccess(t *testing.T) {
@@ -34,8 +34,8 @@ func TestDNSProvider_TimeoutSuccess(t *testing.T) {
 	require.NoError(t, err)
 
 	timeout, interval := provider.Timeout()
-	assert.Equal(t, timeout, 12*time.Minute)
-	assert.Equal(t, interval, 1*time.Minute)
+	assert.Equal(t, 12*time.Minute, timeout)
+	assert.Equal(t, 1*time.Minute, interval)
 }
 
 func TestDNSProvider_Present(t *testing.T) {
diff --git a/providers/http/memcached/memcached_test.go b/providers/http/memcached/memcached_test.go
index fda05ce9..3e687235 100644
--- a/providers/http/memcached/memcached_test.go
+++ b/providers/http/memcached/memcached_test.go
@@ -31,7 +31,7 @@ func loadMemcachedHosts() []string {
 func TestNewMemcachedProviderEmpty(t *testing.T) {
 	emptyHosts := make([]string, 0)
 	_, err := NewMemcachedProvider(emptyHosts)
-	assert.EqualError(t, err, "no memcached hosts provided")
+	require.EqualError(t, err, "no memcached hosts provided")
 }
 
 func TestNewMemcachedProviderValid(t *testing.T) {
diff --git a/providers/http/s3/s3_test.go b/providers/http/s3/s3_test.go
index 88b8438b..c094bd4a 100644
--- a/providers/http/s3/s3_test.go
+++ b/providers/http/s3/s3_test.go
@@ -74,5 +74,5 @@ func TestLiveNewHTTPProvider(t *testing.T) {
 	cleanupResp, err := http.Get(chlgPath)
 	require.NoError(t, err)
 
-	assert.Equal(t, cleanupResp.StatusCode, 403)
+	assert.Equal(t, 403, cleanupResp.StatusCode)
 }