chore: update linter (#2492)

This commit is contained in:
Ludovic Fernandez 2025-03-25 15:05:26 +01:00 committed by GitHub
commit ba7b4bcf11
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 293 additions and 298 deletions

View file

@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-latest
env:
GO_VERSION: stable
GOLANGCI_LINT_VERSION: v1.64.2
GOLANGCI_LINT_VERSION: v2.0.1
HUGO_VERSION: 0.131.0
CGO_ENABLED: 0
LEGO_E2E_TESTS: CI

View file

@ -1,270 +1,266 @@
version: "2"
formatters:
enable:
- gci
- gofmt
- gofumpt
- goimports
linters:
enable-all: true
default: all
disable:
- bodyclose
- canonicalheader
- contextcheck
- cyclop # duplicate of gocyclo
- sqlclosecheck # not relevant (SQL)
- rowserrcheck # not relevant (SQL)
- lll
- gosec
- dupl # not relevant
- prealloc # too many false-positive
- bodyclose # too many false-positive
- mnd
- testpackage # not relevant
- tparallel # not relevant
- paralleltest # not relevant
- nestif # too many false-positive
- wrapcheck
- err113 # not relevant
- nlreturn # not relevant
- wsl # not relevant
- errchkjson
- errname
- exhaustive # not relevant
- exhaustruct # not relevant
- makezero # not relevant
- forbidigo
- varnamelen # not relevant
- nilnil # not relevant
- ireturn # not relevant
- contextcheck # too many false-positive
- tenv # we already have a test "framework" to handle env vars
- noctx
- forcetypeassert
- tagliatelle
- errname
- errchkjson
- nonamedreturns
- gosec
- gosmopolitan # not relevant
- ireturn # not relevant
- lll
- makezero # not relevant
- mnd
- musttag # false-positive https://github.com/junk1tm/musttag/issues/17
- gosmopolitan # not relevant
- canonicalheader # Can create side effects in the context of API clients
- nestif # too many false-positive
- nilnil # not relevant
- nlreturn # not relevant
- noctx
- nonamedreturns
- paralleltest # not relevant
- prealloc # too many false-positive
- rowserrcheck # not relevant (SQL)
- sqlclosecheck # not relevant (SQL)
- tagliatelle
- testpackage # not relevant
- tparallel # not relevant
- usestdlibvars # false-positive https://github.com/sashamelentyev/usestdlibvars/issues/96
- varnamelen # not relevant
- wrapcheck
- wsl # should be enabled it the future.
linters-settings:
govet:
enable-all: true
disable:
- fieldalignment
settings:
printf:
funcs:
- Print
- Printf
- Warn
- Warnf
- Fatal
- Fatalf
gocyclo:
min-complexity: 12
goconst:
min-len: 3
min-occurrences: 3
funlen:
lines: -1
statements: 50
misspell:
locale: US
ignore-words:
- internetbs
depguard:
settings:
depguard:
rules:
main:
deny:
- pkg: github.com/instana/testify
desc: not allowed
- pkg: github.com/pkg/errors
desc: Should be replaced by standard lib errors package
funlen:
lines: -1
statements: 50
goconst:
min-len: 3
min-occurrences: 3
gocritic:
disabled-checks:
- paramTypeCombine # already handle by gofumpt.extra-rules
- whyNoLint # already handle by nonolint
- unnamedResult
- hugeParam
- sloppyReassign
- rangeValCopy
- octalLiteral
- ptrToRefParam
- appendAssign
- ruleguard
- httpNoBody
- exposedSyncMutex
enabled-tags:
- diagnostic
- style
- performance
gocyclo:
min-complexity: 12
godox:
keywords:
- FIXME
govet:
disable:
- fieldalignment
enable-all: true
settings:
printf:
funcs:
- Print
- Printf
- Warn
- Warnf
- Fatal
- Fatalf
misspell:
locale: US
ignore-rules:
- internetbs
perfsprint:
err-error: true
errorf: true
sprintf1: true
strconcat: false
revive:
rules:
- name: struct-tag
- name: blank-imports
- name: context-as-argument
- name: context-keys-type
- name: dot-imports
- name: error-return
- name: error-strings
- name: error-naming
- name: exported
disabled: true
- name: if-return
- name: increment-decrement
- name: var-naming
- name: var-declaration
- name: package-comments
disabled: true
- name: range
- name: receiver-naming
- name: time-naming
- name: unexported-return
- name: indent-error-flow
- name: errorf
- name: empty-block
- name: superfluous-else
- name: unused-parameter
disabled: true
- name: unreachable-code
- name: redefines-builtin-id
tagalign:
align: false
order:
- xml
- json
- yaml
- yml
- toml
- mapstructure
- url
testifylint:
disable:
- require-error
- go-require
usetesting:
os-setenv: false # we already have a test "framework" to handle env vars
exclusions:
warn-unused: true
presets:
- comments
- std-error-handling
rules:
main:
deny:
- pkg: "github.com/instana/testify"
desc: not allowed
- pkg: "github.com/pkg/errors"
desc: Should be replaced by standard lib errors package
tagalign:
align: false
order:
- xml
- json
- yaml
- yml
- toml
- mapstructure
- url
godox:
keywords:
- FIXME
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
- appendAssign
- ruleguard
- httpNoBody
- exposedSyncMutex
revive:
rules:
- name: struct-tag
- name: blank-imports
- name: context-as-argument
- name: context-keys-type
- name: dot-imports
- name: error-return
- name: error-strings
- name: error-naming
- name: exported
disabled: true
- name: if-return
- name: increment-decrement
- name: var-naming
- name: var-declaration
- name: package-comments
disabled: true
- name: range
- name: receiver-naming
- name: time-naming
- name: unexported-return
- name: indent-error-flow
- name: errorf
- name: empty-block
- name: superfluous-else
- name: unused-parameter
disabled: true
- name: unreachable-code
- name: redefines-builtin-id
testifylint:
disable:
- require-error
- go-require
perfsprint:
err-error: true
errorf: true
sprintf1: true
strconcat: false
usetesting:
os-setenv: false # we already have a test "framework" to handle env vars
run:
timeout: 10m
relative-path-mode: cfg
output:
show-stats: true
sort-results: true
sort-order:
- linter
- file
- linters:
- funlen
- goconst
- maintidx
path: (.+)_test.go
- linters:
- errcheck
path: (.+)_test.go
text: Error return value of `fmt.Fprintln` is not checked
- linters:
- gochecknoglobals
path: certcrypto/crypto.go
text: (tlsFeatureExtensionOID|ocspMustStapleFeature) is a global variable
- linters:
- gochecknoglobals
path: challenge/dns01/nameserver.go
text: (defaultNameservers|recursiveNameservers|fqdnSoaCache|muFqdnSoaCache) is a global variable
- linters:
- gochecknoglobals
path: challenge/dns01/nameserver_.+.go
text: dnsTimeout is a global variable
- linters:
- gochecknoglobals
path: challenge/dns01/nameserver_test.go
text: findXByFqdnTestCases is a global variable
- linters:
- goconst
path: challenge/http01/domain_matcher.go
text: string `Host` has \d occurrences, make it a constant
- linters:
- gocyclo
path: challenge/http01/domain_matcher.go
text: cyclomatic complexity \d+ of func `parseForwardedHeader` is high
- linters:
- funlen
path: challenge/http01/domain_matcher.go
text: Function 'parseForwardedHeader' has too many statements
- linters:
- gochecknoglobals
path: challenge/tlsalpn01/tls_alpn_challenge.go
text: idPeAcmeIdentifierV1 is a global variable
- linters:
- gochecknoglobals
path: log/logger.go
text: Logger is a global variable
- linters:
- gochecknoglobals
path: e2e/(dnschallenge/)?[\d\w]+_test.go
text: load is a global variable
- linters:
- gochecknoglobals
path: providers/dns/([\d\w]+/)*[\d\w]+_test.go
text: envTest is a global variable
- linters:
- gochecknoglobals
path: providers/http/([\d\w]+/)*[\d\w]+_test.go
text: envTest is a global variable
- linters:
- gochecknoglobals
path: providers/dns/namecheap/namecheap_test.go
text: testCases is a global variable
- linters:
- gochecknoglobals
path: providers/dns/acmedns/mock_test.go
text: egTestAccount is a global variable
- linters:
- gochecknoglobals
path: providers/http/memcached/memcached_test.go
text: memcachedHosts is a global variable
- linters:
- misspell
path: providers/dns/checkdomain/internal/types.go
text: '`payed` is a misspelling of `paid`'
- linters:
- thelper
path: platform/tester/env_test.go
- linters:
- staticcheck
path: providers/dns/oraclecloud/oraclecloud_test.go
text: 'SA1019: x509.EncryptPEMBlock has been deprecated since Go 1.16'
- linters:
- gochecknoglobals
path: providers/dns/sakuracloud/wrapper.go
text: mu is a global variable
- linters:
- gocyclo
path: cmd/cmd_renew.go
text: cyclomatic complexity \d+ of func `(renewForDomains|renewForCSR)` is high
- linters:
- funlen
path: cmd/cmd_renew.go
text: Function 'renewForDomains' has too many statements
- linters:
- gocyclo
path: providers/dns/cpanel/cpanel.go
text: cyclomatic complexity 13 of func `\(\*DNSProvider\)\.CleanUp` is high
- linters:
- staticcheck
# Those elements have been replaced by non-exposed structures.
path: providers/dns/linode/linode_test.go
text: 'SA1019: linodego\.(DomainsPagedResponse|DomainRecordsPagedResponse) is deprecated'
issues:
exclude-generated: strict
exclude-use-default: false
max-issues-per-linter: 0
max-same-issues: 0
exclude:
- 'Error return value of .((os\.)?std(out|err)\..*|.*Close|.*Flush|os\.Remove(All)?|.*printf?|os\.(Un)?Setenv). is not checked'
- 'exported (type|method|function) (.+) should have comment or be unexported'
- 'ST1000: at least one file in a package should have a package comment'
exclude-rules:
- path: (.+)_test.go
linters:
- funlen
- goconst
- maintidx
- path: (.+)_test.go
text: 'Error return value of `fmt.Fprintln` is not checked'
linters:
- errcheck
- path: certcrypto/crypto.go
text: '(tlsFeatureExtensionOID|ocspMustStapleFeature) is a global variable'
linters:
- gochecknoglobals
- path: challenge/dns01/nameserver.go
text: '(defaultNameservers|recursiveNameservers|fqdnSoaCache|muFqdnSoaCache) is a global variable'
linters:
- gochecknoglobals
- path: challenge/dns01/nameserver_.+.go
text: 'dnsTimeout is a global variable'
linters:
- gochecknoglobals
- path: challenge/dns01/nameserver_test.go
text: 'findXByFqdnTestCases is a global variable'
linters:
- gochecknoglobals
- path: challenge/http01/domain_matcher.go
text: 'string `Host` has \d occurrences, make it a constant'
linters:
- goconst
- path: challenge/http01/domain_matcher.go
text: 'cyclomatic complexity \d+ of func `parseForwardedHeader` is high'
linters:
- gocyclo
- path: challenge/http01/domain_matcher.go
text: "Function 'parseForwardedHeader' has too many statements"
linters:
- funlen
- path: challenge/tlsalpn01/tls_alpn_challenge.go
text: 'idPeAcmeIdentifierV1 is a global variable'
linters:
- gochecknoglobals
- path: log/logger.go
text: 'Logger is a global variable'
linters:
- gochecknoglobals
- path: 'e2e/(dnschallenge/)?[\d\w]+_test.go'
text: load is a global variable
linters:
- gochecknoglobals
- path: 'providers/dns/([\d\w]+/)*[\d\w]+_test.go'
text: 'envTest is a global variable'
linters:
- gochecknoglobals
- path: 'providers/http/([\d\w]+/)*[\d\w]+_test.go'
text: 'envTest is a global variable'
linters:
- gochecknoglobals
- path: providers/dns/namecheap/namecheap_test.go
text: 'testCases is a global variable'
linters:
- gochecknoglobals
- path: providers/dns/acmedns/mock_test.go
text: 'egTestAccount is a global variable'
linters:
- gochecknoglobals
- path: providers/http/memcached/memcached_test.go
text: 'memcachedHosts is a global variable'
linters:
- gochecknoglobals
- path: providers/dns/checkdomain/internal/types.go
text: '`payed` is a misspelling of `paid`'
linters:
- misspell
- path: platform/tester/env_test.go
linters:
- thelper
- path: providers/dns/oraclecloud/oraclecloud_test.go
text: 'SA1019: x509.EncryptPEMBlock has been deprecated since Go 1.16'
linters:
- staticcheck
- path: providers/dns/sakuracloud/wrapper.go
text: 'mu is a global variable'
linters:
- gochecknoglobals
- path: cmd/cmd_renew.go
text: 'cyclomatic complexity \d+ of func `(renewForDomains|renewForCSR)` is high'
linters:
- gocyclo
- path: cmd/cmd_renew.go
text: "Function 'renewForDomains' has too many statements"
linters:
- funlen
- path: providers/dns/cpanel/cpanel.go
text: 'cyclomatic complexity 13 of func `\(\*DNSProvider\)\.CleanUp` is high'
linters:
- gocyclo
# Those elements have been replaced by non-exposed structures.
- path: providers/dns/linode/linode_test.go
linters:
- staticcheck
text: "SA1019: linodego\\.(DomainsPagedResponse|DomainRecordsPagedResponse) is deprecated"

View file

@ -205,7 +205,7 @@ func Test_checkResponse(t *testing.T) {
require.NoError(t, err)
assert.True(t, valid)
assert.NotNil(t, certRes)
assert.Equal(t, "", certRes.Domain)
assert.Empty(t, certRes.Domain)
assert.Contains(t, certRes.CertStableURL, "/certificate")
assert.Contains(t, certRes.CertURL, "/certificate")
assert.Nil(t, certRes.CSR)
@ -255,7 +255,7 @@ func Test_checkResponse_issuerRelUp(t *testing.T) {
require.NoError(t, err)
assert.True(t, valid)
assert.NotNil(t, certRes)
assert.Equal(t, "", certRes.Domain)
assert.Empty(t, certRes.Domain)
assert.Contains(t, certRes.CertStableURL, "/certificate")
assert.Contains(t, certRes.CertURL, "/certificate")
assert.Nil(t, certRes.CSR)
@ -295,7 +295,7 @@ func Test_checkResponse_no_bundle(t *testing.T) {
require.NoError(t, err)
assert.True(t, valid)
assert.NotNil(t, certRes)
assert.Equal(t, "", certRes.Domain)
assert.Empty(t, certRes.Domain)
assert.Contains(t, certRes.CertStableURL, "/certificate")
assert.Contains(t, certRes.CertURL, "/certificate")
assert.Nil(t, certRes.CSR)

View file

@ -39,7 +39,7 @@ func TestLookupNameserversOK(t *testing.T) {
sort.Strings(nss)
sort.Strings(test.nss)
assert.EqualValues(t, test.nss, nss)
assert.Equal(t, test.nss, nss)
})
}
}

View file

@ -77,7 +77,7 @@ func Test_parseForwardedHeader(t *testing.T) {
actual, err := parseForwardedHeader(test.input)
if test.err == "" {
require.NoError(t, err)
assert.EqualValues(t, test.want, actual)
assert.Equal(t, test.want, actual)
} else {
require.Error(t, err)
assert.Contains(t, err.Error(), test.err)

View file

@ -162,7 +162,7 @@ func TestChallengeIPaddress(t *testing.T) {
value, err := asn1.Marshal(zBytes[:sha256.Size])
require.NoError(t, err, "Expected marshaling of the keyAuth to return no error")
require.EqualValues(t, value, extValue, "Expected the challenge certificate id-pe-acmeIdentifier extension to contain the SHA-256 digest of the keyAuth")
require.Equal(t, value, extValue, "Expected the challenge certificate id-pe-acmeIdentifier extension to contain the SHA-256 digest of the keyAuth")
return nil
}

View file

@ -62,7 +62,7 @@ func TestEnvTest(t *testing.T) {
assert.True(t, envTest.IsLiveTest())
assert.Equal(t, "A", envTest.GetValue(envVar01))
assert.Equal(t, "B", envTest.GetValue(envVar02))
assert.Equal(t, "", envTest.GetDomain())
assert.Empty(t, envTest.GetDomain())
},
},
{
@ -75,9 +75,9 @@ func TestEnvTest(t *testing.T) {
},
expected: func(t *testing.T, envTest *tester.EnvTest) {
assert.False(t, envTest.IsLiveTest())
assert.Equal(t, "", envTest.GetValue(envVar01))
assert.Empty(t, envTest.GetValue(envVar01))
assert.Equal(t, "B", envTest.GetValue(envVar02))
assert.Equal(t, "", envTest.GetDomain())
assert.Empty(t, envTest.GetDomain())
},
},
{
@ -94,7 +94,7 @@ func TestEnvTest(t *testing.T) {
assert.True(t, envTest.IsLiveTest())
assert.Equal(t, "A", envTest.GetValue(envVar01))
assert.Equal(t, "B", envTest.GetValue(envVar02))
assert.Equal(t, "", envTest.GetValue(envVarDomain))
assert.Empty(t, envTest.GetValue(envVarDomain))
assert.Equal(t, "D", envTest.GetDomain())
},
},
@ -110,8 +110,8 @@ func TestEnvTest(t *testing.T) {
expected: func(t *testing.T, envTest *tester.EnvTest) {
assert.False(t, envTest.IsLiveTest())
assert.Equal(t, "A", envTest.GetValue(envVar01))
assert.Equal(t, "", envTest.GetValue(envVar02))
assert.Equal(t, "", envTest.GetValue(envVarDomain))
assert.Empty(t, envTest.GetValue(envVar02))
assert.Empty(t, envTest.GetValue(envVarDomain))
assert.Equal(t, "D", envTest.GetDomain())
},
},
@ -128,8 +128,8 @@ func TestEnvTest(t *testing.T) {
assert.False(t, envTest.IsLiveTest())
assert.Equal(t, "A", envTest.GetValue(envVar01))
assert.Equal(t, "B", envTest.GetValue(envVar02))
assert.Equal(t, "", envTest.GetValue(envVarDomain))
assert.Equal(t, "", envTest.GetDomain())
assert.Empty(t, envTest.GetValue(envVarDomain))
assert.Empty(t, envTest.GetDomain())
},
},
{
@ -145,7 +145,7 @@ func TestEnvTest(t *testing.T) {
assert.True(t, envTest.IsLiveTest())
assert.Equal(t, "A", envTest.GetValue(envVar01))
assert.Equal(t, "B", envTest.GetValue(envVar02))
assert.Equal(t, "", envTest.GetDomain())
assert.Empty(t, envTest.GetDomain())
},
},
{
@ -161,7 +161,7 @@ func TestEnvTest(t *testing.T) {
assert.True(t, envTest.IsLiveTest())
assert.Equal(t, "A", envTest.GetValue(envVar01))
assert.Equal(t, "B", envTest.GetValue(envVar02))
assert.Equal(t, "", envTest.GetDomain())
assert.Empty(t, envTest.GetDomain())
},
},
{
@ -174,9 +174,9 @@ func TestEnvTest(t *testing.T) {
},
expected: func(t *testing.T, envTest *tester.EnvTest) {
assert.True(t, envTest.IsLiveTest())
assert.Equal(t, "", envTest.GetValue(envVar01))
assert.Empty(t, envTest.GetValue(envVar01))
assert.Equal(t, "B", envTest.GetValue(envVar02))
assert.Equal(t, "", envTest.GetDomain())
assert.Empty(t, envTest.GetDomain())
},
},
{
@ -190,8 +190,8 @@ func TestEnvTest(t *testing.T) {
expected: func(t *testing.T, envTest *tester.EnvTest) {
assert.False(t, envTest.IsLiveTest())
assert.Equal(t, "A", envTest.GetValue(envVar01))
assert.Equal(t, "", envTest.GetValue(envVar02))
assert.Equal(t, "", envTest.GetDomain())
assert.Empty(t, envTest.GetValue(envVar02))
assert.Empty(t, envTest.GetDomain())
},
},
{
@ -210,7 +210,7 @@ func TestEnvTest(t *testing.T) {
assert.True(t, envTest.IsLiveTest())
assert.Equal(t, "A", envTest.GetValue(envVar01))
assert.Equal(t, "B", envTest.GetValue(envVar02))
assert.Equal(t, "", envTest.GetValue(envVarDomain))
assert.Empty(t, envTest.GetValue(envVarDomain))
assert.Equal(t, "D", envTest.GetDomain())
},
},
@ -229,8 +229,8 @@ func TestEnvTest(t *testing.T) {
assert.True(t, envTest.IsLiveTest())
assert.Equal(t, "A", envTest.GetValue(envVar01))
assert.Equal(t, "B", envTest.GetValue(envVar02))
assert.Equal(t, "", envTest.GetValue(envVarDomain))
assert.Equal(t, "", envTest.GetDomain())
assert.Empty(t, envTest.GetValue(envVarDomain))
assert.Empty(t, envTest.GetDomain())
},
},
{
@ -247,7 +247,7 @@ func TestEnvTest(t *testing.T) {
assert.True(t, envTest.IsLiveTest())
assert.Equal(t, "A", envTest.GetValue(envVar01))
assert.Equal(t, "B", envTest.GetValue(envVar02))
assert.Equal(t, "", envTest.GetDomain())
assert.Empty(t, envTest.GetDomain())
},
},
{
@ -264,7 +264,7 @@ func TestEnvTest(t *testing.T) {
assert.False(t, envTest.IsLiveTest())
assert.Equal(t, "A", envTest.GetValue(envVar01))
assert.Equal(t, "B", envTest.GetValue(envVar02))
assert.Equal(t, "", envTest.GetDomain())
assert.Empty(t, envTest.GetDomain())
},
},
{
@ -282,7 +282,7 @@ func TestEnvTest(t *testing.T) {
assert.True(t, envTest.IsLiveTest())
assert.Equal(t, "A", envTest.GetValue(envVar01))
assert.Equal(t, "B", envTest.GetValue(envVar02))
assert.Equal(t, "", envTest.GetDomain())
assert.Empty(t, envTest.GetDomain())
},
},
{
@ -300,7 +300,7 @@ func TestEnvTest(t *testing.T) {
assert.False(t, envTest.IsLiveTest())
assert.Equal(t, "A", envTest.GetValue(envVar01))
assert.Equal(t, "B", envTest.GetValue(envVar02))
assert.Equal(t, "", envTest.GetDomain())
assert.Empty(t, envTest.GetDomain())
},
},
{
@ -316,8 +316,8 @@ func TestEnvTest(t *testing.T) {
expected: func(t *testing.T, envTest *tester.EnvTest) {
assert.False(t, envTest.IsLiveTest())
assert.Equal(t, "A", envTest.GetValue(envVar01))
assert.Equal(t, "", envTest.GetValue(envVar02))
assert.Equal(t, "", envTest.GetDomain())
assert.Empty(t, envTest.GetValue(envVar02))
assert.Empty(t, envTest.GetDomain())
},
},
}
@ -357,7 +357,7 @@ func TestEnvTest_ClearEnv(t *testing.T) {
envTest.ClearEnv()
assert.Equal(t, "", os.Getenv(envVar01))
assert.Equal(t, "", os.Getenv(envVar02))
assert.Empty(t, os.Getenv(envVar01))
assert.Empty(t, os.Getenv(envVar02))
assert.Equal(t, "X", os.Getenv("EXTRA_LEGO_TEST"))
}

View file

@ -97,7 +97,7 @@ func TestClient_GetZone(t *testing.T) {
desc string
authFQDN string
apiResponse string
expected
expected expected
}{
{
desc: "zone found",
@ -157,7 +157,7 @@ func TestClient_FindTxtRecord(t *testing.T) {
authFQDN string
zoneName string
apiResponse string
expected
expected expected
}{
{
desc: "record found",
@ -264,7 +264,7 @@ func TestClient_ListTxtRecord(t *testing.T) {
authFQDN string
zoneName string
apiResponse string
expected
expected expected
}{
{
desc: "record found",
@ -377,7 +377,7 @@ func TestClient_AddTxtRecord(t *testing.T) {
value string
ttl int
apiResponse string
expected
expected expected
}{
{
desc: "sub-zone",
@ -477,7 +477,7 @@ func TestClient_RemoveTxtRecord(t *testing.T) {
id int
zoneName string
apiResponse string
expected
expected expected
}{
{
desc: "record found",
@ -550,7 +550,7 @@ func TestClient_GetUpdateStatus(t *testing.T) {
authFQDN string
zoneName string
apiResponse string
expected
expected expected
}{
{
desc: "50% sync",

View file

@ -206,7 +206,7 @@ func TestClient_GetZoneRecord(t *testing.T) {
RecordID: 12345678,
},
}
assert.EqualValues(t, expected, recordObjs)
assert.Equal(t, expected, recordObjs)
}
func TestClient_rpcCall_404(t *testing.T) {

View file

@ -124,7 +124,7 @@ func TestClient_Login_errors(t *testing.T) {
sessionID, err := client.login(context.Background())
assert.Error(t, err)
assert.Equal(t, "", sessionID)
assert.Empty(t, sessionID)
})
}
}

View file

@ -168,7 +168,7 @@ func (d *DNSProvider) CleanUp(domain, token, keyAuth string) error {
}
var deleteHash *string
for _, record := range domainRecords.RecordCollection.Items {
for _, record := range domainRecords.Items {
if record.Rdata != nil && *record.Rdata == `"`+info.Value+`"` {
deleteHash = record.RecordHash
break

View file

@ -62,7 +62,7 @@ func (d *DNSProvider) cleanupTXTRecord(fqdn, value string) error {
var updRecords iaas.DNSRecords
for _, r := range zone.Records {
if !(r.Name == subDomain && r.Type == "TXT" && r.RData == value) {
if !(r.Name == subDomain && r.Type == "TXT" && r.RData == value) { //nolint:staticcheck // Clearer without De Morgan's law.
updRecords = append(updRecords, r)
}
}

View file

@ -52,12 +52,11 @@ func utcToCet(utc time.Time) time.Time {
dayOff := 0
breaking := time.Date(utc.Year(), utcMonth+1, dayOff, 1, 0, 0, 0, time.UTC)
for {
if breaking.Weekday() == time.Sunday {
break
}
for breaking.Weekday() != time.Sunday {
dayOff--
breaking = time.Date(utc.Year(), utcMonth+1, dayOff, 1, 0, 0, 0, time.UTC)
if dayOff < -7 {
panic("safety exit to avoid infinite loop")
}