chore: update linter (#1367)

This commit is contained in:
Ludovic Fernandez 2021-03-04 20:16:59 +01:00 committed by GitHub
parent 2c0a8ff689
commit 52ad9d72e8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
108 changed files with 239 additions and 217 deletions

View file

@ -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

View file

@ -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"

View file

@ -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")
}

View file

@ -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")
}

View file

@ -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
}

View file

@ -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")
}

View file

@ -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")
}

View file

@ -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
}

View file

@ -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
}

View file

@ -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.")
}

View file

@ -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

View file

@ -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
}

View file

@ -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)

View file

@ -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)

View file

@ -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
}

View file

@ -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)

View file

@ -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)

View file

@ -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)

View file

@ -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)

View file

@ -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
}

View file

@ -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)

View file

@ -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)

View file

@ -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)

View file

@ -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
}

View file

@ -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)

View file

@ -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)

View file

@ -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)

View file

@ -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)

View file

@ -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)
}

View file

@ -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)

View file

@ -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)

View file

@ -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)

View file

@ -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)

View file

@ -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)

View file

@ -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)

View file

@ -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)
}

View file

@ -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)

View file

@ -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"

View file

@ -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)

View file

@ -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)

View file

@ -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)

View file

@ -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 {

View file

@ -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)
}

View file

@ -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)

View file

@ -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
}

View file

@ -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)

View file

@ -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)

View file

@ -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
}

View file

@ -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
}

View file

@ -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)

View file

@ -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)

View file

@ -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)

View file

@ -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)

View file

@ -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)

View file

@ -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)

View file

@ -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)

View file

@ -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)

View file

@ -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)

View file

@ -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)

View file

@ -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)

View file

@ -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)

View file

@ -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)
}

View file

@ -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)

View file

@ -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)

View file

@ -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)

View file

@ -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)

View file

@ -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)
}
}

View file

@ -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")
}

View file

@ -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)

View file

@ -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)

View file

@ -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)

View file

@ -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)

View file

@ -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)

View file

@ -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 {

View file

@ -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)

View file

@ -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) {

View file

@ -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)

View file

@ -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

View file

@ -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)

View file

@ -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)

View file

@ -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)

View file

@ -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)

View file

@ -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")
}

View file

@ -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)

View file

@ -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)

View file

@ -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)

View file

@ -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)

View file

@ -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)

View file

@ -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)

View file

@ -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)

View file

@ -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 = ""
}

View file

@ -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)

View file

@ -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)
}

View file

@ -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)

View file

@ -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)

View file

@ -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)

View file

@ -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)

View file

@ -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")
}

View file

@ -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 {

View file

@ -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)

Some files were not shown because too many files have changed in this diff Show more