diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e5fa812e..c9824bb6 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -15,7 +15,7 @@ jobs: runs-on: ubuntu-latest env: GO_VERSION: 1.16 - GOLANGCI_LINT_VERSION: v1.36.0 + GOLANGCI_LINT_VERSION: v1.38.0 HUGO_VERSION: 0.54.0 SEIHON_VERSION: v0.5.1 CGO_ENABLED: 0 diff --git a/.golangci.toml b/.golangci.toml index 1129425a..28bd7cab 100644 --- a/.golangci.toml +++ b/.golangci.toml @@ -20,10 +20,32 @@ [linters-settings.misspell] locale = "US" + [linters-settings.depguard] + list-type = "blacklist" + include-go-root = false + packages = ["github.com/pkg/errors"] + + [linters-settings.godox] + keywords = ["FIXME"] + + [linters-settings.gocritic] + enabled-tags = ["diagnostic", "style", "performance"] + disabled-checks= [ + "paramTypeCombine", # already handle by gofumpt.extra-rules + "whyNoLint", # already handle by nonolint + "unnamedResult", + "hugeParam", + "sloppyReassign", + "rangeValCopy", + "octalLiteral", + "ptrToRefParam", + ] + [linters] enable-all = true disable = [ - "maligned", + "interfacer", # deprecated + "maligned", # deprecated "lll", "gas", "dupl", @@ -32,7 +54,6 @@ "bodyclose", "wsl", "stylecheck", - "godox", "gomnd", "testpackage", # not relevant "nestif", # too many false-positive @@ -46,6 +67,9 @@ "makezero", # not relevant "forbidigo", # not relevant "ifshort", # not relevant + "cyclop", # duplicate of gocyclo + "wastedassign", # false-positive https://github.com/sanposhiho/wastedassign/issues/21 + "forcetypeassert", ] [issues] @@ -139,4 +163,7 @@ linters = ["thelper"] [[issues.exclude-rules]] path = "providers/dns/oraclecloud/oraclecloud_test.go" - text = "SA1019: x509.EncryptPEMBlock is deprecated:" + text = "SA1019: x509.EncryptPEMBlock has been deprecated since Go 1.16" + [[issues.exclude-rules]] + path = "challenge/http01/domain_matcher.go" + text = "yodaStyleExpr" diff --git a/acme/api/account.go b/acme/api/account.go index 79daa29d..d1cd72d9 100644 --- a/acme/api/account.go +++ b/acme/api/account.go @@ -46,7 +46,7 @@ func (a *AccountService) NewEAB(accMsg acme.Account, kid, hmacEncoded string) (a // Get Retrieves an account. func (a *AccountService) Get(accountURL string) (acme.Account, error) { - if len(accountURL) == 0 { + if accountURL == "" { return acme.Account{}, errors.New("account[get]: empty URL") } @@ -60,7 +60,7 @@ func (a *AccountService) Get(accountURL string) (acme.Account, error) { // Update Updates an account. func (a *AccountService) Update(accountURL string, req acme.Account) (acme.Account, error) { - if len(accountURL) == 0 { + if accountURL == "" { return acme.Account{}, errors.New("account[update]: empty URL") } @@ -75,7 +75,7 @@ func (a *AccountService) Update(accountURL string, req acme.Account) (acme.Accou // Deactivate Deactivates an account. func (a *AccountService) Deactivate(accountURL string) error { - if len(accountURL) == 0 { + if accountURL == "" { return errors.New("account[deactivate]: empty URL") } diff --git a/acme/api/authorization.go b/acme/api/authorization.go index 47c5ea1e..a9972aa9 100644 --- a/acme/api/authorization.go +++ b/acme/api/authorization.go @@ -10,7 +10,7 @@ type AuthorizationService service // Get Gets an authorization. func (c *AuthorizationService) Get(authzURL string) (acme.Authorization, error) { - if len(authzURL) == 0 { + if authzURL == "" { return acme.Authorization{}, errors.New("authorization[get]: empty URL") } @@ -24,7 +24,7 @@ func (c *AuthorizationService) Get(authzURL string) (acme.Authorization, error) // Deactivate Deactivates an authorization. func (c *AuthorizationService) Deactivate(authzURL string) error { - if len(authzURL) == 0 { + if authzURL == "" { return errors.New("authorization[deactivate]: empty URL") } diff --git a/acme/api/certificate.go b/acme/api/certificate.go index 3947f649..8923644b 100644 --- a/acme/api/certificate.go +++ b/acme/api/certificate.go @@ -62,7 +62,7 @@ func (c *CertificateService) Revoke(req acme.RevokeCertMessage) error { // get Returns the certificate and the "up" link. func (c *CertificateService) get(certURL string, bundle bool) (*acme.RawCertificate, http.Header, error) { - if len(certURL) == 0 { + if certURL == "" { return nil, nil, errors.New("certificate[get]: empty URL") } @@ -112,7 +112,7 @@ func (c *CertificateService) getCertificateChain(cert []byte, headers http.Heade // getIssuerFromLink requests the issuer certificate. func (c *CertificateService) getIssuerFromLink(up string) ([]byte, error) { - if len(up) == 0 { + if up == "" { return nil, nil } diff --git a/acme/api/challenge.go b/acme/api/challenge.go index c7397fa3..875dede6 100644 --- a/acme/api/challenge.go +++ b/acme/api/challenge.go @@ -10,7 +10,7 @@ type ChallengeService service // New Creates a challenge. func (c *ChallengeService) New(chlgURL string) (acme.ExtendedChallenge, error) { - if len(chlgURL) == 0 { + if chlgURL == "" { return acme.ExtendedChallenge{}, errors.New("challenge[new]: empty URL") } @@ -29,7 +29,7 @@ func (c *ChallengeService) New(chlgURL string) (acme.ExtendedChallenge, error) { // Get Gets a challenge. func (c *ChallengeService) Get(chlgURL string) (acme.ExtendedChallenge, error) { - if len(chlgURL) == 0 { + if chlgURL == "" { return acme.ExtendedChallenge{}, errors.New("challenge[get]: empty URL") } diff --git a/acme/api/order.go b/acme/api/order.go index 69a4c70e..7b2a2be7 100644 --- a/acme/api/order.go +++ b/acme/api/order.go @@ -32,7 +32,7 @@ func (o *OrderService) New(domains []string) (acme.ExtendedOrder, error) { // Get Gets an order. func (o *OrderService) Get(orderURL string) (acme.ExtendedOrder, error) { - if len(orderURL) == 0 { + if orderURL == "" { return acme.ExtendedOrder{}, errors.New("order[get]: empty URL") } diff --git a/acme/errors.go b/acme/errors.go index fc68d419..3d6a5ab1 100644 --- a/acme/errors.go +++ b/acme/errors.go @@ -35,7 +35,7 @@ type SubProblem struct { func (p ProblemDetails) Error() string { msg := fmt.Sprintf("acme: error: %d", p.HTTPStatus) - if len(p.Method) != 0 || len(p.URL) != 0 { + if p.Method != "" || p.URL != "" { msg += fmt.Sprintf(" :: %s :: %s", p.Method, p.URL) } msg += fmt.Sprintf(" :: %s :: %s", p.Type, p.Detail) @@ -44,7 +44,7 @@ func (p ProblemDetails) Error() string { msg += fmt.Sprintf(", problem: %q :: %s", sub.Type, sub.Detail) } - if len(p.Instance) != 0 { + if p.Instance != "" { msg += ", url: " + p.Instance } diff --git a/certcrypto/crypto.go b/certcrypto/crypto.go index d4024371..80081ce5 100644 --- a/certcrypto/crypto.go +++ b/certcrypto/crypto.go @@ -173,8 +173,8 @@ func pemDecode(data []byte) (*pem.Block, error) { return pemBlock, nil } -func PemDecodeTox509CSR(pem []byte) (*x509.CertificateRequest, error) { - pemBlock, err := pemDecode(pem) +func PemDecodeTox509CSR(data []byte) (*x509.CertificateRequest, error) { + pemBlock, err := pemDecode(data) if pemBlock == nil { return nil, err } diff --git a/cmd/cmd_before.go b/cmd/cmd_before.go index 68564678..2d7dd465 100644 --- a/cmd/cmd_before.go +++ b/cmd/cmd_before.go @@ -6,7 +6,7 @@ import ( ) func Before(ctx *cli.Context) error { - if len(ctx.GlobalString("path")) == 0 { + if ctx.GlobalString("path") == "" { log.Fatal("Could not determine current working directory. Please pass --path.") } @@ -15,7 +15,7 @@ func Before(ctx *cli.Context) error { log.Fatalf("Could not check/create path: %v", err) } - if len(ctx.GlobalString("server")) == 0 { + if ctx.GlobalString("server") == "" { log.Fatal("Could not determine current working server. Please pass --server.") } diff --git a/cmd/setup.go b/cmd/setup.go index a88cad73..e2a41a57 100644 --- a/cmd/setup.go +++ b/cmd/setup.go @@ -82,7 +82,7 @@ func getKeyType(ctx *cli.Context) certcrypto.KeyType { func getEmail(ctx *cli.Context) string { email := ctx.GlobalString("email") - if len(email) == 0 { + if email == "" { log.Fatal("You have to pass an account (email address) to the program using --email or -m") } return email diff --git a/platform/config/env/env.go b/platform/config/env/env.go index 334b076a..d6428b06 100644 --- a/platform/config/env/env.go +++ b/platform/config/env/env.go @@ -66,7 +66,7 @@ func GetWithFallback(groups ...[]string) (map[string]string, error) { } value, envVar := getOneWithFallback(names[0], names[1:]...) - if len(value) == 0 { + if value == "" { missingEnvVars = append(missingEnvVars, envVar) continue } @@ -122,7 +122,7 @@ func GetOrDefaultSecond(envVar string, defaultValue time.Duration) time.Duration // Returns the default if the envvar cannot be find. func GetOrDefaultString(envVar, defaultValue string) string { v := GetOrFile(envVar) - if len(v) == 0 { + if v == "" { return defaultValue } diff --git a/platform/tester/env.go b/platform/tester/env.go index 943842db..1cbfd279 100644 --- a/platform/tester/env.go +++ b/platform/tester/env.go @@ -87,7 +87,7 @@ func (e *EnvTest) IsLiveTest() bool { liveTest = liveTest && len(e.values) == len(e.keys) - if liveTest && len(e.domainKey) > 0 && len(e.domain) == 0 { + if liveTest && e.domainKey != "" && e.domain == "" { return false } @@ -129,7 +129,7 @@ func (e *EnvTest) Apply(envVars map[string]string) { panic(fmt.Sprintf("Unauthorized action, the env var %s is not managed.", key)) } - if len(value) == 0 { + if value == "" { os.Unsetenv(key) } else { os.Setenv(key, value) diff --git a/platform/tester/env_test.go b/platform/tester/env_test.go index 1c6760ad..23980a1f 100644 --- a/platform/tester/env_test.go +++ b/platform/tester/env_test.go @@ -24,7 +24,7 @@ func TestMain(m *testing.M) { func applyEnv(envVars map[string]string) { for key, value := range envVars { - if len(value) == 0 { + if value == "" { os.Unsetenv(key) } else { os.Setenv(key, value) diff --git a/providers/dns/alidns/alidns.go b/providers/dns/alidns/alidns.go index 62963b7f..a05d54b4 100644 --- a/providers/dns/alidns/alidns.go +++ b/providers/dns/alidns/alidns.go @@ -86,7 +86,7 @@ func NewDNSProviderConfig(config *Config) (*DNSProvider, error) { return nil, fmt.Errorf("alicloud: credentials missing") } - if len(config.RegionID) == 0 { + if config.RegionID == "" { config.RegionID = defaultRegionID } diff --git a/providers/dns/alidns/alidns_test.go b/providers/dns/alidns/alidns_test.go index 9a427de6..1a38dbfe 100644 --- a/providers/dns/alidns/alidns_test.go +++ b/providers/dns/alidns/alidns_test.go @@ -63,7 +63,7 @@ func TestNewDNSProvider(t *testing.T) { p, err := NewDNSProvider() - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) require.NotNil(t, p.config) @@ -111,7 +111,7 @@ func TestNewDNSProviderConfig(t *testing.T) { p, err := NewDNSProviderConfig(config) - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) require.NotNil(t, p.config) diff --git a/providers/dns/arvancloud/arvancloud_test.go b/providers/dns/arvancloud/arvancloud_test.go index 7c90df5f..c31edf02 100644 --- a/providers/dns/arvancloud/arvancloud_test.go +++ b/providers/dns/arvancloud/arvancloud_test.go @@ -43,7 +43,7 @@ func TestNewDNSProvider(t *testing.T) { p, err := NewDNSProvider() - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) require.NotNil(t, p.config) @@ -87,7 +87,7 @@ func TestNewDNSProviderConfig(t *testing.T) { p, err := NewDNSProviderConfig(config) - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) require.NotNil(t, p.config) diff --git a/providers/dns/auroradns/auroradns_test.go b/providers/dns/auroradns/auroradns_test.go index 128e18f2..4a5f669b 100644 --- a/providers/dns/auroradns/auroradns_test.go +++ b/providers/dns/auroradns/auroradns_test.go @@ -81,7 +81,7 @@ func TestNewDNSProvider(t *testing.T) { p, err := NewDNSProvider() - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) require.NotNil(t, p.config) @@ -133,7 +133,7 @@ func TestNewDNSProviderConfig(t *testing.T) { p, err := NewDNSProviderConfig(config) - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) require.NotNil(t, p.config) diff --git a/providers/dns/autodns/autodns_test.go b/providers/dns/autodns/autodns_test.go index 60c77400..900efbdf 100644 --- a/providers/dns/autodns/autodns_test.go +++ b/providers/dns/autodns/autodns_test.go @@ -64,7 +64,7 @@ func TestNewDNSProvider(t *testing.T) { p, err := NewDNSProvider() - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) require.NotNil(t, p.config) @@ -115,7 +115,7 @@ func TestNewDNSProviderConfig(t *testing.T) { p, err := NewDNSProviderConfig(config) - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) require.NotNil(t, p.config) diff --git a/providers/dns/azure/azure.go b/providers/dns/azure/azure.go index 82e9e884..091b912f 100644 --- a/providers/dns/azure/azure.go +++ b/providers/dns/azure/azure.go @@ -291,7 +291,7 @@ func getAuthorizer(config *Config) (autorest.Authorizer, error) { // borrowed from https://github.com/Microsoft/azureimds/blob/master/imdssample.go func getMetadata(config *Config, field string) (string, error) { metadataEndpoint := config.MetadataEndpoint - if len(metadataEndpoint) == 0 { + if metadataEndpoint == "" { metadataEndpoint = defaultMetadataEndpoint } diff --git a/providers/dns/azure/azure_test.go b/providers/dns/azure/azure_test.go index a7613f36..e9acfaf9 100644 --- a/providers/dns/azure/azure_test.go +++ b/providers/dns/azure/azure_test.go @@ -59,7 +59,7 @@ func TestNewDNSProvider(t *testing.T) { p, err := NewDNSProvider() - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) require.NotNil(t, p.config) @@ -144,7 +144,7 @@ func TestNewDNSProviderConfig(t *testing.T) { p, err := NewDNSProviderConfig(config) - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) require.NotNil(t, p.config) diff --git a/providers/dns/bindman/bindman_test.go b/providers/dns/bindman/bindman_test.go index b428f606..a0db025e 100644 --- a/providers/dns/bindman/bindman_test.go +++ b/providers/dns/bindman/bindman_test.go @@ -53,7 +53,7 @@ func TestNewDNSProvider(t *testing.T) { p, err := NewDNSProvider() - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) require.NotNil(t, p.config) @@ -95,7 +95,7 @@ func TestNewDNSProviderConfig(t *testing.T) { t.Run(test.desc, func(t *testing.T) { p, err := NewDNSProviderConfig(test.config) - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) require.NotNil(t, p.config) diff --git a/providers/dns/bluecat/bluecat_test.go b/providers/dns/bluecat/bluecat_test.go index 67290dbe..5a3670e3 100644 --- a/providers/dns/bluecat/bluecat_test.go +++ b/providers/dns/bluecat/bluecat_test.go @@ -111,7 +111,7 @@ func TestNewDNSProvider(t *testing.T) { p, err := NewDNSProvider() - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) require.NotNil(t, p.config) @@ -202,7 +202,7 @@ func TestNewDNSProviderConfig(t *testing.T) { p, err := NewDNSProviderConfig(config) - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) require.NotNil(t, p.config) diff --git a/providers/dns/bluecat/client.go b/providers/dns/bluecat/client.go index 711cf80f..9ee0fd2f 100644 --- a/providers/dns/bluecat/client.go +++ b/providers/dns/bluecat/client.go @@ -59,7 +59,7 @@ func (d *DNSProvider) login() error { // Destroys Bluecat Session. func (d *DNSProvider) logout() error { - if len(d.token) == 0 { + if d.token == "" { // nothing to do return nil } diff --git a/providers/dns/checkdomain/checkdomain_test.go b/providers/dns/checkdomain/checkdomain_test.go index b5cde5f6..eb9f05d3 100644 --- a/providers/dns/checkdomain/checkdomain_test.go +++ b/providers/dns/checkdomain/checkdomain_test.go @@ -52,7 +52,7 @@ func TestNewDNSProvider(t *testing.T) { p, err := NewDNSProvider() - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) require.NotNil(t, p.config) @@ -91,7 +91,7 @@ func TestNewDNSProviderConfig(t *testing.T) { p, err := NewDNSProviderConfig(config) - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) require.NotNil(t, p.config) diff --git a/providers/dns/clouddns/clouddns_test.go b/providers/dns/clouddns/clouddns_test.go index 9ee0069a..d7bfc4a1 100644 --- a/providers/dns/clouddns/clouddns_test.go +++ b/providers/dns/clouddns/clouddns_test.go @@ -69,7 +69,7 @@ func TestNewDNSProvider(t *testing.T) { p, err := NewDNSProvider() - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) assert.NotNil(t, p.config) @@ -131,7 +131,7 @@ func TestNewDNSProviderConfig(t *testing.T) { p, err := NewDNSProviderConfig(config) - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) require.NotNil(t, p.config) diff --git a/providers/dns/cloudflare/cloudflare_test.go b/providers/dns/cloudflare/cloudflare_test.go index b39ea34a..0aed5125 100644 --- a/providers/dns/cloudflare/cloudflare_test.go +++ b/providers/dns/cloudflare/cloudflare_test.go @@ -78,7 +78,7 @@ func TestNewDNSProvider(t *testing.T) { p, err := NewDNSProvider() - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) assert.NotNil(t, p.config) @@ -253,7 +253,7 @@ func TestNewDNSProviderConfig(t *testing.T) { p, err := NewDNSProviderConfig(config) - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) assert.NotNil(t, p.config) diff --git a/providers/dns/cloudns/cloudns_test.go b/providers/dns/cloudns/cloudns_test.go index 9b57ae82..ea4f25c9 100644 --- a/providers/dns/cloudns/cloudns_test.go +++ b/providers/dns/cloudns/cloudns_test.go @@ -85,7 +85,7 @@ func TestNewDNSProvider(t *testing.T) { p, err := NewDNSProvider() - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) require.NotNil(t, p.config) @@ -151,7 +151,7 @@ func TestNewDNSProviderConfig(t *testing.T) { p, err := NewDNSProviderConfig(config) - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) require.NotNil(t, p.config) diff --git a/providers/dns/cloudns/internal/client.go b/providers/dns/cloudns/internal/client.go index 83645d25..4a994244 100644 --- a/providers/dns/cloudns/internal/client.go +++ b/providers/dns/cloudns/internal/client.go @@ -265,8 +265,8 @@ func (c *Client) GetUpdateStatus(zoneName string) (*SyncProgress, error) { return &SyncProgress{Complete: updatedCount == len(records), Updated: updatedCount, Total: len(records)}, nil } -func (c *Client) doRequest(method string, url *url.URL) (json.RawMessage, error) { - req, err := c.buildRequest(method, url) +func (c *Client) doRequest(method string, uri *url.URL) (json.RawMessage, error) { + req, err := c.buildRequest(method, uri) if err != nil { return nil, err } @@ -290,8 +290,8 @@ func (c *Client) doRequest(method string, url *url.URL) (json.RawMessage, error) return content, nil } -func (c *Client) buildRequest(method string, url *url.URL) (*http.Request, error) { - q := url.Query() +func (c *Client) buildRequest(method string, uri *url.URL) (*http.Request, error) { + q := uri.Query() if c.subAuthID != "" { q.Set("sub-auth-id", c.subAuthID) @@ -301,9 +301,9 @@ func (c *Client) buildRequest(method string, url *url.URL) (*http.Request, error q.Set("auth-password", c.authPassword) - url.RawQuery = q.Encode() + uri.RawQuery = q.Encode() - req, err := http.NewRequest(method, url.String(), nil) + req, err := http.NewRequest(method, uri.String(), nil) if err != nil { return nil, fmt.Errorf("invalid request: %w", err) } diff --git a/providers/dns/cloudxns/cloudxns_test.go b/providers/dns/cloudxns/cloudxns_test.go index a3f0229e..43dd8a99 100644 --- a/providers/dns/cloudxns/cloudxns_test.go +++ b/providers/dns/cloudxns/cloudxns_test.go @@ -63,7 +63,7 @@ func TestNewDNSProvider(t *testing.T) { p, err := NewDNSProvider() - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) require.NotNil(t, p.config) @@ -111,7 +111,7 @@ func TestNewDNSProviderConfig(t *testing.T) { p, err := NewDNSProviderConfig(config) - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) require.NotNil(t, p.config) diff --git a/providers/dns/conoha/conoha_test.go b/providers/dns/conoha/conoha_test.go index 7a492bff..75e38b7f 100644 --- a/providers/dns/conoha/conoha_test.go +++ b/providers/dns/conoha/conoha_test.go @@ -78,7 +78,7 @@ func TestNewDNSProvider(t *testing.T) { p, err := NewDNSProvider() - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) require.NotNil(t, p.config) @@ -137,7 +137,7 @@ func TestNewDNSProviderConfig(t *testing.T) { p, err := NewDNSProviderConfig(config) - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) require.NotNil(t, p.config) diff --git a/providers/dns/constellix/constellix_test.go b/providers/dns/constellix/constellix_test.go index dee0f59d..e3a30cac 100644 --- a/providers/dns/constellix/constellix_test.go +++ b/providers/dns/constellix/constellix_test.go @@ -63,7 +63,7 @@ func TestNewDNSProvider(t *testing.T) { p, err := NewDNSProvider() - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) require.NotNil(t, p.config) @@ -112,7 +112,7 @@ func TestNewDNSProviderConfig(t *testing.T) { p, err := NewDNSProviderConfig(config) - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) require.NotNil(t, p.config) diff --git a/providers/dns/desec/desec_test.go b/providers/dns/desec/desec_test.go index 94f6dfcc..f91f9e82 100644 --- a/providers/dns/desec/desec_test.go +++ b/providers/dns/desec/desec_test.go @@ -42,7 +42,7 @@ func TestNewDNSProvider(t *testing.T) { p, err := NewDNSProvider() - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) require.NotNil(t, p.config) @@ -76,7 +76,7 @@ func TestNewDNSProviderConfig(t *testing.T) { p, err := NewDNSProviderConfig(config) - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) require.NotNil(t, p.config) diff --git a/providers/dns/designate/designate_test.go b/providers/dns/designate/designate_test.go index fe6de437..7ea3e49b 100644 --- a/providers/dns/designate/designate_test.go +++ b/providers/dns/designate/designate_test.go @@ -112,7 +112,7 @@ func TestNewDNSProvider_fromEnv(t *testing.T) { p, err := NewDNSProvider() - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) require.NotNil(t, p.config) @@ -202,7 +202,7 @@ func TestNewDNSProvider_fromCloud(t *testing.T) { p, err := NewDNSProvider() - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) require.NotNil(t, p.config) @@ -251,7 +251,7 @@ func TestNewDNSProviderConfig(t *testing.T) { p, err := NewDNSProviderConfig(config) - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) require.NotNil(t, p.config) diff --git a/providers/dns/digitalocean/digitalocean_test.go b/providers/dns/digitalocean/digitalocean_test.go index ab9e005b..2d631860 100644 --- a/providers/dns/digitalocean/digitalocean_test.go +++ b/providers/dns/digitalocean/digitalocean_test.go @@ -60,7 +60,7 @@ func TestNewDNSProvider(t *testing.T) { p, err := NewDNSProvider() - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) require.NotNil(t, p.config) @@ -95,7 +95,7 @@ func TestNewDNSProviderConfig(t *testing.T) { p, err := NewDNSProviderConfig(config) - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) require.NotNil(t, p.config) diff --git a/providers/dns/dnsimple/dnsimple_test.go b/providers/dns/dnsimple/dnsimple_test.go index 2cd7862b..c07f965b 100644 --- a/providers/dns/dnsimple/dnsimple_test.go +++ b/providers/dns/dnsimple/dnsimple_test.go @@ -57,7 +57,7 @@ func TestNewDNSProvider(t *testing.T) { p, err := NewDNSProvider() - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) require.NotNil(t, p.config) @@ -105,7 +105,7 @@ func TestNewDNSProviderConfig(t *testing.T) { p, err := NewDNSProviderConfig(config) - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) require.NotNil(t, p.config) @@ -128,7 +128,7 @@ func TestLivePresent(t *testing.T) { envTest.RestoreEnv() - if len(os.Getenv(EnvBaseURL)) == 0 { + if os.Getenv(EnvBaseURL) == "" { os.Setenv(EnvBaseURL, sandboxURL) } @@ -146,7 +146,7 @@ func TestLiveCleanUp(t *testing.T) { envTest.RestoreEnv() - if len(os.Getenv(EnvBaseURL)) == 0 { + if os.Getenv(EnvBaseURL) == "" { os.Setenv(EnvBaseURL, sandboxURL) } diff --git a/providers/dns/dnsmadeeasy/dnsmadeeasy_test.go b/providers/dns/dnsmadeeasy/dnsmadeeasy_test.go index d3523e04..5c508e60 100644 --- a/providers/dns/dnsmadeeasy/dnsmadeeasy_test.go +++ b/providers/dns/dnsmadeeasy/dnsmadeeasy_test.go @@ -65,7 +65,7 @@ func TestNewDNSProvider(t *testing.T) { p, err := NewDNSProvider() - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) require.NotNil(t, p.config) @@ -115,7 +115,7 @@ func TestNewDNSProviderConfig(t *testing.T) { p, err := NewDNSProviderConfig(config) - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) require.NotNil(t, p.config) diff --git a/providers/dns/dnspod/dnspod.toml b/providers/dns/dnspod/dnspod.toml index 7edddc96..6d027f7d 100644 --- a/providers/dns/dnspod/dnspod.toml +++ b/providers/dns/dnspod/dnspod.toml @@ -19,5 +19,5 @@ lego --email myemail@example.com --dns dnspod --domains my.example.org run DNSPOD_HTTP_TIMEOUT = "API request timeout" [Links] - API = "https://www.dnspod.com/docs/index.html" + API = "https://docs.dnspod.com/api/" GoClient = "https://github.com/nrdcg/dnspod-go" diff --git a/providers/dns/dnspod/dnspod_test.go b/providers/dns/dnspod/dnspod_test.go index 4abd1baa..640ec34c 100644 --- a/providers/dns/dnspod/dnspod_test.go +++ b/providers/dns/dnspod/dnspod_test.go @@ -43,7 +43,7 @@ func TestNewDNSProvider(t *testing.T) { p, err := NewDNSProvider() - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) require.NotNil(t, p.config) @@ -78,7 +78,7 @@ func TestNewDNSProviderConfig(t *testing.T) { p, err := NewDNSProviderConfig(config) - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) require.NotNil(t, p.config) diff --git a/providers/dns/dode/dode_test.go b/providers/dns/dode/dode_test.go index 59ab0163..67a61433 100644 --- a/providers/dns/dode/dode_test.go +++ b/providers/dns/dode/dode_test.go @@ -43,7 +43,7 @@ func TestNewDNSProvider(t *testing.T) { p, err := NewDNSProvider() - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) require.NotNil(t, p.config) @@ -77,7 +77,7 @@ func TestNewDNSProviderConfig(t *testing.T) { p, err := NewDNSProviderConfig(config) - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) require.NotNil(t, p.config) diff --git a/providers/dns/domeneshop/domeneshop_test.go b/providers/dns/domeneshop/domeneshop_test.go index ffb55200..389975bc 100644 --- a/providers/dns/domeneshop/domeneshop_test.go +++ b/providers/dns/domeneshop/domeneshop_test.go @@ -63,7 +63,7 @@ func TestNewDNSProvider(t *testing.T) { p, err := NewDNSProvider() - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) require.NotNil(t, p.config) @@ -113,7 +113,7 @@ func TestNewDNSProviderConfig(t *testing.T) { p, err := NewDNSProviderConfig(config) - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) require.NotNil(t, p.config) diff --git a/providers/dns/dreamhost/dreamhost_test.go b/providers/dns/dreamhost/dreamhost_test.go index 88eac009..2c288108 100644 --- a/providers/dns/dreamhost/dreamhost_test.go +++ b/providers/dns/dreamhost/dreamhost_test.go @@ -69,7 +69,7 @@ func TestNewDNSProvider(t *testing.T) { p, err := NewDNSProvider() - if len(test.expected) == 0 { + if test.expected == "" { assert.NoError(t, err) assert.NotNil(t, p) } else { @@ -102,7 +102,7 @@ func TestNewDNSProviderConfig(t *testing.T) { p, err := NewDNSProviderConfig(config) - if len(test.expected) == 0 { + if test.expected == "" { assert.NoError(t, err) assert.NotNil(t, p) } else { diff --git a/providers/dns/duckdns/client.go b/providers/dns/duckdns/client.go index a3be86d9..37593376 100644 --- a/providers/dns/duckdns/client.go +++ b/providers/dns/duckdns/client.go @@ -18,7 +18,7 @@ func (d *DNSProvider) updateTxtRecord(domain, token, txt string, clear bool) err u, _ := url.Parse("https://www.duckdns.org/update") mainDomain := getMainDomain(domain) - if len(mainDomain) == 0 { + if mainDomain == "" { return fmt.Errorf("unable to find the main domain for: %s", domain) } diff --git a/providers/dns/duckdns/duckdns_test.go b/providers/dns/duckdns/duckdns_test.go index 4c9943e4..36ec5a64 100644 --- a/providers/dns/duckdns/duckdns_test.go +++ b/providers/dns/duckdns/duckdns_test.go @@ -44,7 +44,7 @@ func TestNewDNSProvider(t *testing.T) { p, err := NewDNSProvider() - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) require.NotNil(t, p.config) @@ -78,7 +78,7 @@ func TestNewDNSProviderConfig(t *testing.T) { p, err := NewDNSProviderConfig(config) - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) require.NotNil(t, p.config) diff --git a/providers/dns/dyn/client.go b/providers/dns/dyn/client.go index 52faf2c2..bf87b654 100644 --- a/providers/dns/dyn/client.go +++ b/providers/dns/dyn/client.go @@ -62,7 +62,7 @@ func (d *DNSProvider) login() error { // Destroys Dyn Session. func (d *DNSProvider) logout() error { - if len(d.token) == 0 { + if d.token == "" { // nothing to do return nil } diff --git a/providers/dns/dyn/dyn_test.go b/providers/dns/dyn/dyn_test.go index 53ee6f59..25f1f561 100644 --- a/providers/dns/dyn/dyn_test.go +++ b/providers/dns/dyn/dyn_test.go @@ -77,7 +77,7 @@ func TestNewDNSProvider(t *testing.T) { p, err := NewDNSProvider() - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) require.NotNil(t, p.config) @@ -138,7 +138,7 @@ func TestNewDNSProviderConfig(t *testing.T) { p, err := NewDNSProviderConfig(config) - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) require.NotNil(t, p.config) diff --git a/providers/dns/dynu/dynu_test.go b/providers/dns/dynu/dynu_test.go index a129dcec..fe2c22df 100644 --- a/providers/dns/dynu/dynu_test.go +++ b/providers/dns/dynu/dynu_test.go @@ -44,7 +44,7 @@ func TestNewDNSProvider(t *testing.T) { p, err := NewDNSProvider() - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) require.NotNil(t, p.config) @@ -79,7 +79,7 @@ func TestNewDNSProviderConfig(t *testing.T) { p, err := NewDNSProviderConfig(config) - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) require.NotNil(t, p.config) diff --git a/providers/dns/dynu/internal/client.go b/providers/dns/dynu/internal/client.go index 12089e02..1f9753e4 100644 --- a/providers/dns/dynu/internal/client.go +++ b/providers/dns/dynu/internal/client.go @@ -122,7 +122,7 @@ func (c Client) GetRootDomain(hostname string) (*DNSHostname, error) { } // doRetry the API is really unstable so we need to retry on EOF. -func (c Client) doRetry(method, url string, body []byte, data interface{}) error { +func (c Client) doRetry(method, uri string, body []byte, data interface{}) error { var resp *http.Response ctx, cancel := context.WithCancel(context.Background()) @@ -133,7 +133,7 @@ func (c Client) doRetry(method, url string, body []byte, data interface{}) error reqBody = bytes.NewReader(body) } - req, err := http.NewRequest(method, url, reqBody) + req, err := http.NewRequest(method, uri, reqBody) if err != nil { return err } diff --git a/providers/dns/easydns/client.go b/providers/dns/easydns/client.go index 87ed6b89..36465389 100644 --- a/providers/dns/easydns/client.go +++ b/providers/dns/easydns/client.go @@ -51,7 +51,7 @@ func (d *DNSProvider) deleteRecord(domain, recordID string) error { return d.doRequest(http.MethodDelete, pathDelete, nil, nil) } -func (d *DNSProvider) doRequest(method, path string, requestMsg, responseMsg interface{}) error { +func (d *DNSProvider) doRequest(method, resource string, requestMsg, responseMsg interface{}) error { reqBody := &bytes.Buffer{} if requestMsg != nil { err := json.NewEncoder(reqBody).Encode(requestMsg) @@ -60,7 +60,7 @@ func (d *DNSProvider) doRequest(method, path string, requestMsg, responseMsg int } } - endpoint, err := d.config.Endpoint.Parse(path + "?format=json") + endpoint, err := d.config.Endpoint.Parse(resource + "?format=json") if err != nil { return err } diff --git a/providers/dns/easydns/easydns_test.go b/providers/dns/easydns/easydns_test.go index c532cc57..47fe5ac1 100644 --- a/providers/dns/easydns/easydns_test.go +++ b/providers/dns/easydns/easydns_test.go @@ -82,7 +82,7 @@ func TestNewDNSProvider(t *testing.T) { p, err := NewDNSProvider() - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) require.NotNil(t, p.config) @@ -131,7 +131,7 @@ func TestNewDNSProviderConfig(t *testing.T) { t.Run(test.desc, func(t *testing.T) { p, err := NewDNSProviderConfig(test.config) - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) require.NotNil(t, p.config) diff --git a/providers/dns/exoscale/exoscale_test.go b/providers/dns/exoscale/exoscale_test.go index 556837f9..87b668c9 100644 --- a/providers/dns/exoscale/exoscale_test.go +++ b/providers/dns/exoscale/exoscale_test.go @@ -64,7 +64,7 @@ func TestNewDNSProvider(t *testing.T) { p, err := NewDNSProvider() - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) require.NotNil(t, p.config) @@ -112,7 +112,7 @@ func TestNewDNSProviderConfig(t *testing.T) { p, err := NewDNSProviderConfig(config) - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) require.NotNil(t, p.config) diff --git a/providers/dns/gandi/gandi_test.go b/providers/dns/gandi/gandi_test.go index 705ad801..1a72a714 100644 --- a/providers/dns/gandi/gandi_test.go +++ b/providers/dns/gandi/gandi_test.go @@ -45,7 +45,7 @@ func TestNewDNSProvider(t *testing.T) { p, err := NewDNSProvider() - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) require.NotNil(t, p.config) @@ -81,7 +81,7 @@ func TestNewDNSProviderConfig(t *testing.T) { p, err := NewDNSProviderConfig(config) - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) require.NotNil(t, p.config) diff --git a/providers/dns/gandiv5/gandiv5_test.go b/providers/dns/gandiv5/gandiv5_test.go index d5ead948..8b3a9e96 100644 --- a/providers/dns/gandiv5/gandiv5_test.go +++ b/providers/dns/gandiv5/gandiv5_test.go @@ -45,7 +45,7 @@ func TestNewDNSProvider(t *testing.T) { p, err := NewDNSProvider() - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) require.NotNil(t, p.config) @@ -80,7 +80,7 @@ func TestNewDNSProviderConfig(t *testing.T) { p, err := NewDNSProviderConfig(config) - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) require.NotNil(t, p.config) diff --git a/providers/dns/gcloud/googlecloud_test.go b/providers/dns/gcloud/googlecloud_test.go index 35efb3ef..e5554286 100644 --- a/providers/dns/gcloud/googlecloud_test.go +++ b/providers/dns/gcloud/googlecloud_test.go @@ -90,7 +90,7 @@ func TestNewDNSProvider(t *testing.T) { p, err := NewDNSProvider() - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) require.NotNil(t, p.config) @@ -130,7 +130,7 @@ func TestNewDNSProviderConfig(t *testing.T) { p, err := NewDNSProviderConfig(config) - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) require.NotNil(t, p.config) diff --git a/providers/dns/glesys/glesys_test.go b/providers/dns/glesys/glesys_test.go index fd5e5bb2..d5fdf36d 100644 --- a/providers/dns/glesys/glesys_test.go +++ b/providers/dns/glesys/glesys_test.go @@ -62,7 +62,7 @@ func TestNewDNSProvider(t *testing.T) { p, err := NewDNSProvider() - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) require.NotNil(t, p.config) @@ -112,7 +112,7 @@ func TestNewDNSProviderConfig(t *testing.T) { p, err := NewDNSProviderConfig(config) - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) require.NotNil(t, p.config) diff --git a/providers/dns/godaddy/godaddy_test.go b/providers/dns/godaddy/godaddy_test.go index 8f0ce60a..4cb5f272 100644 --- a/providers/dns/godaddy/godaddy_test.go +++ b/providers/dns/godaddy/godaddy_test.go @@ -62,7 +62,7 @@ func TestNewDNSProvider(t *testing.T) { p, err := NewDNSProvider() - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) require.NotNil(t, p.config) @@ -109,7 +109,7 @@ func TestNewDNSProviderConfig(t *testing.T) { p, err := NewDNSProviderConfig(config) - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) require.NotNil(t, p.config) diff --git a/providers/dns/hetzner/hetzner_test.go b/providers/dns/hetzner/hetzner_test.go index 72f9ad63..f69fcdc1 100644 --- a/providers/dns/hetzner/hetzner_test.go +++ b/providers/dns/hetzner/hetzner_test.go @@ -43,7 +43,7 @@ func TestNewDNSProvider(t *testing.T) { p, err := NewDNSProvider() - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) require.NotNil(t, p.config) @@ -87,7 +87,7 @@ func TestNewDNSProviderConfig(t *testing.T) { p, err := NewDNSProviderConfig(config) - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) require.NotNil(t, p.config) diff --git a/providers/dns/hostingde/hostingde_test.go b/providers/dns/hostingde/hostingde_test.go index e9242735..32537bb0 100644 --- a/providers/dns/hostingde/hostingde_test.go +++ b/providers/dns/hostingde/hostingde_test.go @@ -63,7 +63,7 @@ func TestNewDNSProvider(t *testing.T) { p, err := NewDNSProvider() - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) require.NotNil(t, p.config) @@ -111,7 +111,7 @@ func TestNewDNSProviderConfig(t *testing.T) { p, err := NewDNSProviderConfig(config) - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) require.NotNil(t, p.config) diff --git a/providers/dns/httpreq/httpreq_test.go b/providers/dns/httpreq/httpreq_test.go index 184afad1..4632f2c3 100644 --- a/providers/dns/httpreq/httpreq_test.go +++ b/providers/dns/httpreq/httpreq_test.go @@ -52,7 +52,7 @@ func TestNewDNSProvider(t *testing.T) { p, err := NewDNSProvider() - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) require.NotNil(t, p.config) @@ -86,7 +86,7 @@ func TestNewDNSProviderConfig(t *testing.T) { p, err := NewDNSProviderConfig(config) - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) require.NotNil(t, p.config) diff --git a/providers/dns/hurricane/hurricane_test.go b/providers/dns/hurricane/hurricane_test.go index 1622285c..12217c79 100644 --- a/providers/dns/hurricane/hurricane_test.go +++ b/providers/dns/hurricane/hurricane_test.go @@ -61,7 +61,7 @@ func TestNewDNSProvider(t *testing.T) { p, err := NewDNSProvider() - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) require.NotNil(t, p.config) @@ -103,7 +103,7 @@ func TestNewDNSProviderConfig(t *testing.T) { p, err := NewDNSProviderConfig(config) - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) require.NotNil(t, p.config) diff --git a/providers/dns/hyperone/hyperone_test.go b/providers/dns/hyperone/hyperone_test.go index 167ece1f..1222d1c7 100644 --- a/providers/dns/hyperone/hyperone_test.go +++ b/providers/dns/hyperone/hyperone_test.go @@ -55,7 +55,7 @@ func TestNewDNSProvider(t *testing.T) { p, err := NewDNSProvider() - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) require.NotNil(t, p.config) @@ -106,7 +106,7 @@ func TestNewDNSProviderConfig(t *testing.T) { p, err := NewDNSProviderConfig(config) - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) require.NotNil(t, p.config) diff --git a/providers/dns/iij/iij.go b/providers/dns/iij/iij.go index b48b7933..a32de614 100644 --- a/providers/dns/iij/iij.go +++ b/providers/dns/iij/iij.go @@ -236,7 +236,7 @@ func splitDomain(domain string, zones []string) (string, string, error) { } } - if len(owner) == 0 { + if owner == "" { return "", "", fmt.Errorf("%s not found", domain) } diff --git a/providers/dns/iij/iij_test.go b/providers/dns/iij/iij_test.go index 9c55ded3..73a0ba64 100644 --- a/providers/dns/iij/iij_test.go +++ b/providers/dns/iij/iij_test.go @@ -77,7 +77,7 @@ func TestNewDNSProvider(t *testing.T) { p, err := NewDNSProvider() - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) require.NotNil(t, p.config) @@ -139,7 +139,7 @@ func TestNewDNSProviderConfig(t *testing.T) { p, err := NewDNSProviderConfig(config) - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) require.NotNil(t, p.config) diff --git a/providers/dns/infomaniak/infomaniak_test.go b/providers/dns/infomaniak/infomaniak_test.go index 9ad0df86..bc8fb7b5 100644 --- a/providers/dns/infomaniak/infomaniak_test.go +++ b/providers/dns/infomaniak/infomaniak_test.go @@ -45,7 +45,7 @@ func TestNewDNSProvider(t *testing.T) { p, err := NewDNSProvider() - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) require.NotNil(t, p.config) @@ -82,7 +82,7 @@ func TestNewDNSProviderConfig(t *testing.T) { p, err := NewDNSProviderConfig(config) - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) require.NotNil(t, p.config) diff --git a/providers/dns/inwx/inwx_test.go b/providers/dns/inwx/inwx_test.go index e742f8ec..14dbd434 100644 --- a/providers/dns/inwx/inwx_test.go +++ b/providers/dns/inwx/inwx_test.go @@ -66,7 +66,7 @@ func TestNewDNSProvider(t *testing.T) { p, err := NewDNSProvider() - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) require.NotNil(t, p.config) @@ -104,7 +104,7 @@ func TestNewDNSProviderConfig(t *testing.T) { p, err := NewDNSProviderConfig(config) - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) require.NotNil(t, p.config) diff --git a/providers/dns/ionos/ionos_test.go b/providers/dns/ionos/ionos_test.go index c6f3176b..5aef6ad1 100644 --- a/providers/dns/ionos/ionos_test.go +++ b/providers/dns/ionos/ionos_test.go @@ -43,7 +43,7 @@ func TestNewDNSProvider(t *testing.T) { p, err := NewDNSProvider() - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) require.NotNil(t, p.config) @@ -88,7 +88,7 @@ func TestNewDNSProviderConfig(t *testing.T) { p, err := NewDNSProviderConfig(config) - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) require.NotNil(t, p.config) diff --git a/providers/dns/joker/provider_dmapi.go b/providers/dns/joker/provider_dmapi.go index 7a0ef877..b0940898 100644 --- a/providers/dns/joker/provider_dmapi.go +++ b/providers/dns/joker/provider_dmapi.go @@ -26,7 +26,7 @@ func newDmapiProvider() (*dmapiProvider, error) { var errU error values, errU = env.Get(EnvUsername, EnvPassword) if errU != nil { - // nolint:errorlint + // nolint:errorlint // false-positive return nil, fmt.Errorf("joker: %v or %v", errU, err) } } diff --git a/providers/dns/linode/linode.go b/providers/dns/linode/linode.go index b2c5a379..15209751 100644 --- a/providers/dns/linode/linode.go +++ b/providers/dns/linode/linode.go @@ -84,7 +84,7 @@ func NewDNSProviderConfig(config *Config) (*DNSProvider, error) { return nil, errors.New("linode: the configuration of the DNS provider is nil") } - if len(config.Token) == 0 { + if config.Token == "" { return nil, errors.New("linode: Linode Access Token missing") } diff --git a/providers/dns/linode/linode_test.go b/providers/dns/linode/linode_test.go index e763a159..6d208e7a 100644 --- a/providers/dns/linode/linode_test.go +++ b/providers/dns/linode/linode_test.go @@ -87,7 +87,7 @@ func TestNewDNSProvider(t *testing.T) { p, err := NewDNSProvider() - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) require.NotNil(t, p.config) @@ -122,7 +122,7 @@ func TestNewDNSProviderConfig(t *testing.T) { p, err := NewDNSProviderConfig(config) - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) require.NotNil(t, p.config) @@ -214,7 +214,7 @@ func TestDNSProvider_Present(t *testing.T) { p.client.SetBaseURL(server.URL) err = p.Present(domain, "", keyAuth) - if len(test.expectedError) == 0 { + if test.expectedError == "" { assert.NoError(t, err) } else { assert.EqualError(t, err, test.expectedError) @@ -329,7 +329,7 @@ func TestDNSProvider_CleanUp(t *testing.T) { p.client.SetBaseURL(server.URL) err = p.CleanUp(domain, "", keyAuth) - if len(test.expectedError) == 0 { + if test.expectedError == "" { assert.NoError(t, err) } else { assert.EqualError(t, err, test.expectedError) diff --git a/providers/dns/liquidweb/liquidweb_test.go b/providers/dns/liquidweb/liquidweb_test.go index 4dceadff..91221cb0 100644 --- a/providers/dns/liquidweb/liquidweb_test.go +++ b/providers/dns/liquidweb/liquidweb_test.go @@ -93,7 +93,7 @@ func TestNewDNSProvider(t *testing.T) { p, err := NewDNSProvider() - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) require.NotNil(t, p.config) @@ -159,7 +159,7 @@ func TestNewDNSProviderConfig(t *testing.T) { p, err := NewDNSProviderConfig(config) - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) require.NotNil(t, p.config) diff --git a/providers/dns/loopia/internal/client_test.go b/providers/dns/loopia/internal/client_test.go index a283242b..a3c55120 100644 --- a/providers/dns/loopia/internal/client_test.go +++ b/providers/dns/loopia/internal/client_test.go @@ -59,7 +59,7 @@ func TestClient_AddZoneRecord(t *testing.T) { client.BaseURL = serverURL + "/" err := client.AddTXTRecord(test.domain, exampleSubDomain, 123, "TXTrecord") - if len(test.err) == 0 { + if test.err == "" { require.NoError(t, err) } else { require.Error(t, err) @@ -116,7 +116,7 @@ func TestClient_RemoveSubdomain(t *testing.T) { client.BaseURL = serverURL + "/" err := client.RemoveSubdomain(test.domain, exampleSubDomain) - if len(test.err) == 0 { + if test.err == "" { require.NoError(t, err) } else { require.Error(t, err) @@ -173,7 +173,7 @@ func TestClient_RemoveZoneRecord(t *testing.T) { client.BaseURL = serverURL + "/" err := client.RemoveTXTRecord(test.domain, exampleSubDomain, 12345678) - if len(test.err) == 0 { + if test.err == "" { require.NoError(t, err) } else { require.Error(t, err) diff --git a/providers/dns/loopia/loopia_test.go b/providers/dns/loopia/loopia_test.go index 9e50e324..cacffabf 100644 --- a/providers/dns/loopia/loopia_test.go +++ b/providers/dns/loopia/loopia_test.go @@ -108,7 +108,7 @@ func TestNewDNSProvider(t *testing.T) { p, err := NewDNSProvider() - if len(test.expectedError) == 0 { + if test.expectedError == "" { require.NoError(t, err) require.NotNil(t, p) } else { @@ -173,7 +173,7 @@ func TestNewDNSProviderConfig(t *testing.T) { t.Run(test.desc, func(t *testing.T) { p, err := NewDNSProviderConfig(test.config) - if len(test.expectedError) == 0 { + if test.expectedError == "" { require.NoError(t, err) require.NotNil(t, p) assert.Equal(t, test.expectedTTL, p.config.TTL) diff --git a/providers/dns/luadns/luadns_test.go b/providers/dns/luadns/luadns_test.go index 2374cabb..e83aab11 100644 --- a/providers/dns/luadns/luadns_test.go +++ b/providers/dns/luadns/luadns_test.go @@ -64,7 +64,7 @@ func TestNewDNSProvider(t *testing.T) { p, err := NewDNSProvider() - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) require.NotNil(t, p.config) @@ -125,7 +125,7 @@ func TestNewDNSProviderConfig(t *testing.T) { p, err := NewDNSProviderConfig(config) - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) require.NotNil(t, p.config) diff --git a/providers/dns/mydnsjp/mydnsjp_test.go b/providers/dns/mydnsjp/mydnsjp_test.go index 2532114d..71a28fef 100644 --- a/providers/dns/mydnsjp/mydnsjp_test.go +++ b/providers/dns/mydnsjp/mydnsjp_test.go @@ -62,7 +62,7 @@ func TestNewDNSProvider(t *testing.T) { p, err := NewDNSProvider() - if len(test.expected) == 0 { + if test.expected == "" { assert.NoError(t, err) assert.NotNil(t, p) } else { @@ -108,7 +108,7 @@ func TestNewDNSProviderConfig(t *testing.T) { p, err := NewDNSProviderConfig(config) - if len(test.expected) == 0 { + if test.expected == "" { assert.NoError(t, err) assert.NotNil(t, p) } else { diff --git a/providers/dns/mythicbeasts/mythicbeasts_test.go b/providers/dns/mythicbeasts/mythicbeasts_test.go index 8862c36b..5a8a9d4b 100644 --- a/providers/dns/mythicbeasts/mythicbeasts_test.go +++ b/providers/dns/mythicbeasts/mythicbeasts_test.go @@ -63,7 +63,7 @@ func TestNewDNSProvider(t *testing.T) { p, err := NewDNSProvider() - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) require.NotNil(t, p.config) @@ -113,7 +113,7 @@ func TestNewDNSProviderConfig(t *testing.T) { p, err := NewDNSProviderConfig(config) - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) require.NotNil(t, p.config) diff --git a/providers/dns/namecheap/client.go b/providers/dns/namecheap/client.go index 7ebd02ea..9fd6eefb 100644 --- a/providers/dns/namecheap/client.go +++ b/providers/dns/namecheap/client.go @@ -124,11 +124,7 @@ func (d *DNSProvider) do(req *http.Request, out interface{}) error { return err } - if err := xml.Unmarshal(body, out); err != nil { - return err - } - - return nil + return xml.Unmarshal(body, out) } func (d *DNSProvider) newRequestGet(cmd string, params ...func(url.Values)) (*http.Request, error) { diff --git a/providers/dns/namecheap/namecheap.go b/providers/dns/namecheap/namecheap.go index 819152e4..ed1f8dd2 100644 --- a/providers/dns/namecheap/namecheap.go +++ b/providers/dns/namecheap/namecheap.go @@ -125,7 +125,7 @@ func NewDNSProviderConfig(config *Config) (*DNSProvider, error) { return nil, errors.New("namecheap: credentials missing") } - if len(config.ClientIP) == 0 { + if config.ClientIP == "" { clientIP, err := getClientIP(config.HTTPClient, config.Debug) if err != nil { return nil, fmt.Errorf("namecheap: %w", err) diff --git a/providers/dns/namecheap/namecheap_test.go b/providers/dns/namecheap/namecheap_test.go index 2d0e3481..0b8afb7a 100644 --- a/providers/dns/namecheap/namecheap_test.go +++ b/providers/dns/namecheap/namecheap_test.go @@ -223,9 +223,9 @@ func mockServer(t *testing.T, tc *testCase) string { return server.URL } -func mockDNSProvider(url string) *DNSProvider { +func mockDNSProvider(baseURL string) *DNSProvider { config := NewDefaultConfig() - config.BaseURL = url + config.BaseURL = baseURL config.APIUser = envTestUser config.APIKey = envTestKey config.ClientIP = envTestClientIP diff --git a/providers/dns/namedotcom/namedotcom_test.go b/providers/dns/namedotcom/namedotcom_test.go index ecdf2fe3..c7d4deaa 100644 --- a/providers/dns/namedotcom/namedotcom_test.go +++ b/providers/dns/namedotcom/namedotcom_test.go @@ -63,7 +63,7 @@ func TestNewDNSProvider(t *testing.T) { p, err := NewDNSProvider() - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) require.NotNil(t, p.config) @@ -113,7 +113,7 @@ func TestNewDNSProviderConfig(t *testing.T) { p, err := NewDNSProviderConfig(config) - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) require.NotNil(t, p.config) diff --git a/providers/dns/namesilo/namesilo_test.go b/providers/dns/namesilo/namesilo_test.go index a756f454..07244479 100644 --- a/providers/dns/namesilo/namesilo_test.go +++ b/providers/dns/namesilo/namesilo_test.go @@ -51,7 +51,7 @@ func TestNewDNSProvider(t *testing.T) { p, err := NewDNSProvider() - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) require.NotNil(t, p.config) @@ -95,7 +95,7 @@ func TestNewDNSProviderConfig(t *testing.T) { p, err := NewDNSProviderConfig(config) - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) require.NotNil(t, p.config) diff --git a/providers/dns/netcup/netcup_test.go b/providers/dns/netcup/netcup_test.go index 20279d61..ade0d848 100644 --- a/providers/dns/netcup/netcup_test.go +++ b/providers/dns/netcup/netcup_test.go @@ -78,7 +78,7 @@ func TestNewDNSProvider(t *testing.T) { p, err := NewDNSProvider() - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) require.NotNil(t, p.config) @@ -140,7 +140,7 @@ func TestNewDNSProviderConfig(t *testing.T) { p, err := NewDNSProviderConfig(config) - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) require.NotNil(t, p.config) diff --git a/providers/dns/netlify/netlify_test.go b/providers/dns/netlify/netlify_test.go index a535cae0..f351802d 100644 --- a/providers/dns/netlify/netlify_test.go +++ b/providers/dns/netlify/netlify_test.go @@ -42,7 +42,7 @@ func TestNewDNSProvider(t *testing.T) { p, err := NewDNSProvider() - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) require.NotNil(t, p.config) @@ -76,7 +76,7 @@ func TestNewDNSProviderConfig(t *testing.T) { p, err := NewDNSProviderConfig(config) - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) require.NotNil(t, p.config) diff --git a/providers/dns/nifcloud/internal/client.go b/providers/dns/nifcloud/internal/client.go index c9f9cb7d..0c21208a 100644 --- a/providers/dns/nifcloud/internal/client.go +++ b/providers/dns/nifcloud/internal/client.go @@ -89,7 +89,7 @@ type ChangeInfo struct { // NewClient Creates a new client of NIFCLOUD DNS. func NewClient(accessKey, secretKey string) (*Client, error) { - if len(accessKey) == 0 || len(secretKey) == 0 { + if accessKey == "" || secretKey == "" { return nil, errors.New("credentials missing") } diff --git a/providers/dns/nifcloud/nifcloud_test.go b/providers/dns/nifcloud/nifcloud_test.go index 72c0b92f..9b635edf 100644 --- a/providers/dns/nifcloud/nifcloud_test.go +++ b/providers/dns/nifcloud/nifcloud_test.go @@ -63,7 +63,7 @@ func TestNewDNSProvider(t *testing.T) { p, err := NewDNSProvider() - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) require.NotNil(t, p.config) @@ -111,7 +111,7 @@ func TestNewDNSProviderConfig(t *testing.T) { p, err := NewDNSProviderConfig(config) - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) require.NotNil(t, p.config) diff --git a/providers/dns/njalla/njalla_test.go b/providers/dns/njalla/njalla_test.go index 37affbe7..f1489257 100644 --- a/providers/dns/njalla/njalla_test.go +++ b/providers/dns/njalla/njalla_test.go @@ -42,7 +42,7 @@ func TestNewDNSProvider(t *testing.T) { p, err := NewDNSProvider() - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) require.NotNil(t, p.config) @@ -77,7 +77,7 @@ func TestNewDNSProviderConfig(t *testing.T) { p, err := NewDNSProviderConfig(config) - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) require.NotNil(t, p.config) diff --git a/providers/dns/ns1/ns1_test.go b/providers/dns/ns1/ns1_test.go index e8f1d280..ea4eaa64 100644 --- a/providers/dns/ns1/ns1_test.go +++ b/providers/dns/ns1/ns1_test.go @@ -44,7 +44,7 @@ func TestNewDNSProvider(t *testing.T) { p, err := NewDNSProvider() - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) require.NotNil(t, p.config) @@ -79,7 +79,7 @@ func TestNewDNSProviderConfig(t *testing.T) { p, err := NewDNSProviderConfig(config) - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) require.NotNil(t, p.config) diff --git a/providers/dns/oraclecloud/oraclecloud_test.go b/providers/dns/oraclecloud/oraclecloud_test.go index 81c905c4..9caf2de2 100644 --- a/providers/dns/oraclecloud/oraclecloud_test.go +++ b/providers/dns/oraclecloud/oraclecloud_test.go @@ -185,7 +185,7 @@ func TestNewDNSProvider(t *testing.T) { p, err := NewDNSProvider() - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) require.NotNil(t, p.config) @@ -230,7 +230,7 @@ func TestNewDNSProviderConfig(t *testing.T) { p, err := NewDNSProviderConfig(config) - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) require.NotNil(t, p.config) diff --git a/providers/dns/ovh/ovh_test.go b/providers/dns/ovh/ovh_test.go index 4586edcd..d38de1f2 100644 --- a/providers/dns/ovh/ovh_test.go +++ b/providers/dns/ovh/ovh_test.go @@ -103,7 +103,7 @@ func TestNewDNSProvider(t *testing.T) { p, err := NewDNSProvider() - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) require.NotNil(t, p.config) @@ -188,7 +188,7 @@ func TestNewDNSProviderConfig(t *testing.T) { p, err := NewDNSProviderConfig(config) - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) require.NotNil(t, p.config) diff --git a/providers/dns/pdns/pdns_test.go b/providers/dns/pdns/pdns_test.go index 6af2ad29..854b159d 100644 --- a/providers/dns/pdns/pdns_test.go +++ b/providers/dns/pdns/pdns_test.go @@ -63,7 +63,7 @@ func TestNewDNSProvider(t *testing.T) { p, err := NewDNSProvider() - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) require.NotNil(t, p.config) @@ -117,7 +117,7 @@ func TestNewDNSProviderConfig(t *testing.T) { p, err := NewDNSProviderConfig(config) - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) require.NotNil(t, p.config) diff --git a/providers/dns/regru/regru_test.go b/providers/dns/regru/regru_test.go index 29a2b221..15d86d75 100644 --- a/providers/dns/regru/regru_test.go +++ b/providers/dns/regru/regru_test.go @@ -63,7 +63,7 @@ func TestNewDNSProvider(t *testing.T) { p, err := NewDNSProvider() - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) require.NotNil(t, p.config) @@ -112,7 +112,7 @@ func TestNewDNSProviderConfig(t *testing.T) { p, err := NewDNSProviderConfig(config) - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) require.NotNil(t, p.config) diff --git a/providers/dns/rfc2136/rfc2136.go b/providers/dns/rfc2136/rfc2136.go index a34ebfa8..aa3258be 100644 --- a/providers/dns/rfc2136/rfc2136.go +++ b/providers/dns/rfc2136/rfc2136.go @@ -105,8 +105,7 @@ func NewDNSProviderConfig(config *Config) (*DNSProvider, error) { } } - if len(config.TSIGKey) == 0 && len(config.TSIGSecret) > 0 || - len(config.TSIGKey) > 0 && len(config.TSIGSecret) == 0 { + if config.TSIGKey == "" || config.TSIGSecret == "" { config.TSIGKey = "" config.TSIGSecret = "" } diff --git a/providers/dns/rimuhosting/rimuhosting_test.go b/providers/dns/rimuhosting/rimuhosting_test.go index 64db164b..cbdacedc 100644 --- a/providers/dns/rimuhosting/rimuhosting_test.go +++ b/providers/dns/rimuhosting/rimuhosting_test.go @@ -42,7 +42,7 @@ func TestNewDNSProvider(t *testing.T) { p, err := NewDNSProvider() - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) require.NotNil(t, p.config) @@ -80,7 +80,7 @@ func TestNewDNSProviderConfig(t *testing.T) { p, err := NewDNSProviderConfig(config) - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) require.NotNil(t, p.config) diff --git a/providers/dns/route53/route53.go b/providers/dns/route53/route53.go index 723f80e3..b7f9f706 100644 --- a/providers/dns/route53/route53.go +++ b/providers/dns/route53/route53.go @@ -286,7 +286,7 @@ func (d *DNSProvider) getHostedZoneID(fqdn string) (string, error) { } } - if len(hostedZoneID) == 0 { + if hostedZoneID == "" { return "", fmt.Errorf("zone %s not found for domain %s", authZone, fqdn) } diff --git a/providers/dns/sakuracloud/sakuracloud_test.go b/providers/dns/sakuracloud/sakuracloud_test.go index 693f7c5c..93cf20ea 100644 --- a/providers/dns/sakuracloud/sakuracloud_test.go +++ b/providers/dns/sakuracloud/sakuracloud_test.go @@ -63,7 +63,7 @@ func TestNewDNSProvider(t *testing.T) { p, err := NewDNSProvider() - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) require.NotNil(t, p.config) @@ -111,7 +111,7 @@ func TestNewDNSProviderConfig(t *testing.T) { p, err := NewDNSProviderConfig(config) - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) require.NotNil(t, p.config) diff --git a/providers/dns/scaleway/scaleway_test.go b/providers/dns/scaleway/scaleway_test.go index 1016471c..74776f4b 100644 --- a/providers/dns/scaleway/scaleway_test.go +++ b/providers/dns/scaleway/scaleway_test.go @@ -44,7 +44,7 @@ func TestNewDNSProvider(t *testing.T) { p, err := NewDNSProvider() - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) assert.NotNil(t, p.config) @@ -84,7 +84,7 @@ func TestNewDNSProviderConfig(t *testing.T) { p, err := NewDNSProviderConfig(config) - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) assert.NotNil(t, p.config) diff --git a/providers/dns/selectel/selectel_test.go b/providers/dns/selectel/selectel_test.go index 9b86160c..0e2de2db 100644 --- a/providers/dns/selectel/selectel_test.go +++ b/providers/dns/selectel/selectel_test.go @@ -42,7 +42,7 @@ func TestNewDNSProvider(t *testing.T) { p, err := NewDNSProvider() - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) assert.NotNil(t, p.config) @@ -88,7 +88,7 @@ func TestNewDNSProviderConfig(t *testing.T) { p, err := NewDNSProviderConfig(config) - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) assert.NotNil(t, p.config) diff --git a/providers/dns/servercow/servercow_test.go b/providers/dns/servercow/servercow_test.go index 4ecf6735..1c3facad 100644 --- a/providers/dns/servercow/servercow_test.go +++ b/providers/dns/servercow/servercow_test.go @@ -63,7 +63,7 @@ func TestNewDNSProvider(t *testing.T) { p, err := NewDNSProvider() - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) require.NotNil(t, p.config) @@ -112,7 +112,7 @@ func TestNewDNSProviderConfig(t *testing.T) { p, err := NewDNSProviderConfig(config) - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) require.NotNil(t, p.config) diff --git a/providers/dns/stackpath/stackpath.go b/providers/dns/stackpath/stackpath.go index aba40ff7..19efc1ae 100644 --- a/providers/dns/stackpath/stackpath.go +++ b/providers/dns/stackpath/stackpath.go @@ -84,11 +84,11 @@ func NewDNSProviderConfig(config *Config) (*DNSProvider, error) { return nil, errors.New("stackpath: the configuration of the DNS provider is nil") } - if len(config.ClientID) == 0 || len(config.ClientSecret) == 0 { + if config.ClientID == "" || config.ClientSecret == "" { return nil, errors.New("stackpath: credentials missing") } - if len(config.StackID) == 0 { + if config.StackID == "" { return nil, errors.New("stackpath: stack id missing") } diff --git a/providers/dns/stackpath/stackpath_test.go b/providers/dns/stackpath/stackpath_test.go index 861301d9..bcb7ddbc 100644 --- a/providers/dns/stackpath/stackpath_test.go +++ b/providers/dns/stackpath/stackpath_test.go @@ -81,7 +81,7 @@ func TestNewDNSProvider(t *testing.T) { p, err := NewDNSProvider() - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) assert.NotNil(t, p) } else { diff --git a/providers/dns/transip/transip_test.go b/providers/dns/transip/transip_test.go index b61277a0..281f9308 100644 --- a/providers/dns/transip/transip_test.go +++ b/providers/dns/transip/transip_test.go @@ -70,7 +70,7 @@ func TestNewDNSProvider(t *testing.T) { p, err := NewDNSProvider() - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) require.NotNil(t, p.config) @@ -135,7 +135,7 @@ func TestNewDNSProviderConfig(t *testing.T) { p, err := NewDNSProviderConfig(config) - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) require.NotNil(t, p.config) diff --git a/providers/dns/vegadns/vegadns_test.go b/providers/dns/vegadns/vegadns_test.go index 291f7f2d..a789c919 100644 --- a/providers/dns/vegadns/vegadns_test.go +++ b/providers/dns/vegadns/vegadns_test.go @@ -73,7 +73,7 @@ func TestDNSProvider_Present(t *testing.T) { require.NoError(t, err) err = provider.Present(testDomain, "token", "keyAuth") - if len(test.expectedError) == 0 { + if test.expectedError == "" { assert.NoError(t, err) } else { assert.EqualError(t, err, test.expectedError) @@ -116,7 +116,7 @@ func TestDNSProvider_CleanUp(t *testing.T) { require.NoError(t, err) err = provider.CleanUp(testDomain, "token", "keyAuth") - if len(test.expectedError) == 0 { + if test.expectedError == "" { assert.NoError(t, err) } else { assert.EqualError(t, err, test.expectedError) diff --git a/providers/dns/versio/versio_test.go b/providers/dns/versio/versio_test.go index e7b116e3..2e2163e0 100644 --- a/providers/dns/versio/versio_test.go +++ b/providers/dns/versio/versio_test.go @@ -61,7 +61,7 @@ func TestNewDNSProvider(t *testing.T) { p, err := NewDNSProvider() - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) require.NotNil(t, p.config) @@ -110,7 +110,7 @@ func TestNewDNSProviderConfig(t *testing.T) { t.Run(test.desc, func(t *testing.T) { p, err := NewDNSProviderConfig(test.config) - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) require.NotNil(t, p.config) @@ -160,7 +160,7 @@ func TestDNSProvider_Present(t *testing.T) { require.NoError(t, err) err = provider.Present(testDomain, "token", "keyAuth") - if len(test.expectedError) == 0 { + if test.expectedError == "" { require.NoError(t, err) } else { assert.EqualError(t, err, test.expectedError) @@ -204,7 +204,7 @@ func TestDNSProvider_CleanUp(t *testing.T) { require.NoError(t, err) err = provider.CleanUp(testDomain, "token", "keyAuth") - if len(test.expectedError) == 0 { + if test.expectedError == "" { require.NoError(t, err) } else { require.EqualError(t, err, test.expectedError) diff --git a/providers/dns/vscale/vscale_test.go b/providers/dns/vscale/vscale_test.go index 57c847ad..6a9b2558 100644 --- a/providers/dns/vscale/vscale_test.go +++ b/providers/dns/vscale/vscale_test.go @@ -42,7 +42,7 @@ func TestNewDNSProvider(t *testing.T) { p, err := NewDNSProvider() - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) assert.NotNil(t, p.config) @@ -88,7 +88,7 @@ func TestNewDNSProviderConfig(t *testing.T) { p, err := NewDNSProviderConfig(config) - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) assert.NotNil(t, p.config) diff --git a/providers/dns/vultr/vultr_test.go b/providers/dns/vultr/vultr_test.go index 75d64883..2f03e337 100644 --- a/providers/dns/vultr/vultr_test.go +++ b/providers/dns/vultr/vultr_test.go @@ -51,7 +51,7 @@ func TestNewDNSProvider(t *testing.T) { p, err := NewDNSProvider() - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) require.NotNil(t, p.config) @@ -86,7 +86,7 @@ func TestNewDNSProviderConfig(t *testing.T) { p, err := NewDNSProviderConfig(config) - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) require.NotNil(t, p.config) diff --git a/providers/dns/yandex/yandex_test.go b/providers/dns/yandex/yandex_test.go index 7b607a22..144a2412 100644 --- a/providers/dns/yandex/yandex_test.go +++ b/providers/dns/yandex/yandex_test.go @@ -39,7 +39,7 @@ func TestNewDNSProvider(t *testing.T) { p, err := NewDNSProvider() - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) require.NotNil(t, p.config) @@ -78,7 +78,7 @@ func TestNewDNSProviderConfig(t *testing.T) { t.Run(test.desc, func(t *testing.T) { p, err := NewDNSProviderConfig(test.config) - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) require.NotNil(t, p.config) diff --git a/providers/dns/zoneee/zoneee_test.go b/providers/dns/zoneee/zoneee_test.go index f7414f01..09ae33e1 100644 --- a/providers/dns/zoneee/zoneee_test.go +++ b/providers/dns/zoneee/zoneee_test.go @@ -76,7 +76,7 @@ func TestNewDNSProvider(t *testing.T) { p, err := NewDNSProvider() - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) require.NotNil(t, p.config) @@ -128,7 +128,7 @@ func TestNewDNSProviderConfig(t *testing.T) { p, err := NewDNSProviderConfig(config) - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) require.NotNil(t, p.config) @@ -381,7 +381,7 @@ func mockHandlerGetRecords(records []txtRecord) http.HandlerFunc { } for _, value := range records { - if len(value.ResourceURL) == 0 { + if value.ResourceURL == "" { value.ResourceURL = req.URL.String() + "/" + value.ID } } diff --git a/providers/dns/zonomi/zonomi_test.go b/providers/dns/zonomi/zonomi_test.go index 0c2d65c3..fb1b6877 100644 --- a/providers/dns/zonomi/zonomi_test.go +++ b/providers/dns/zonomi/zonomi_test.go @@ -42,7 +42,7 @@ func TestNewDNSProvider(t *testing.T) { p, err := NewDNSProvider() - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) require.NotNil(t, p.config) @@ -80,7 +80,7 @@ func TestNewDNSProviderConfig(t *testing.T) { p, err := NewDNSProviderConfig(config) - if len(test.expected) == 0 { + if test.expected == "" { require.NoError(t, err) require.NotNil(t, p) require.NotNil(t, p.config) diff --git a/registration/registar.go b/registration/registar.go index 8f97403b..25a1b7df 100644 --- a/registration/registar.go +++ b/registration/registar.go @@ -57,7 +57,7 @@ func (r *Registrar) Register(options RegisterOptions) (*Resource, error) { account, err := r.core.Accounts.New(accMsg) if err != nil { - // FIXME seems impossible + // seems impossible var errorDetails acme.ProblemDetails if !errors.As(err, &errorDetails) || errorDetails.HTTPStatus != http.StatusConflict { return nil, err @@ -81,7 +81,7 @@ func (r *Registrar) RegisterWithExternalAccountBinding(options RegisterEABOption account, err := r.core.Accounts.NewEAB(accMsg, options.Kid, options.HmacEncoded) if err != nil { - // FIXME seems impossible + // seems impossible var errorDetails acme.ProblemDetails if !errors.As(err, &errorDetails) || errorDetails.HTTPStatus != http.StatusConflict { return nil, err