mirror of
https://github.com/go-acme/lego
synced 2026-03-14 14:35:48 +01:00
chore: update linter (#2507)
This commit is contained in:
parent
fcc64f0068
commit
b2faa73e23
5 changed files with 76 additions and 78 deletions
2
.github/workflows/pr.yml
vendored
2
.github/workflows/pr.yml
vendored
|
|
@ -13,7 +13,7 @@ jobs:
|
|||
runs-on: ubuntu-latest
|
||||
env:
|
||||
GO_VERSION: stable
|
||||
GOLANGCI_LINT_VERSION: v2.0.1
|
||||
GOLANGCI_LINT_VERSION: v2.1.1
|
||||
HUGO_VERSION: 0.131.0
|
||||
CGO_ENABLED: 0
|
||||
LEGO_E2E_TESTS: CI
|
||||
|
|
|
|||
168
.golangci.yml
168
.golangci.yml
|
|
@ -152,6 +152,8 @@ linters:
|
|||
- go-require
|
||||
usetesting:
|
||||
os-setenv: false # we already have a test "framework" to handle env vars
|
||||
funcorder:
|
||||
struct-method: false
|
||||
|
||||
exclusions:
|
||||
warn-unused: true
|
||||
|
|
@ -159,107 +161,103 @@ linters:
|
|||
- comments
|
||||
- std-error-handling
|
||||
rules:
|
||||
- linters:
|
||||
- path: (.+)_test.go
|
||||
linters:
|
||||
- funlen
|
||||
- goconst
|
||||
- maintidx
|
||||
path: (.+)_test.go
|
||||
- linters:
|
||||
- errcheck
|
||||
path: (.+)_test.go
|
||||
- path: (.+)_test.go
|
||||
text: Error return value of `fmt.Fprintln` is not checked
|
||||
- linters:
|
||||
- gochecknoglobals
|
||||
path: certcrypto/crypto.go
|
||||
linters:
|
||||
- errcheck
|
||||
- path: certcrypto/crypto.go
|
||||
text: (tlsFeatureExtensionOID|ocspMustStapleFeature) is a global variable
|
||||
- linters:
|
||||
linters:
|
||||
- gochecknoglobals
|
||||
path: challenge/dns01/nameserver.go
|
||||
- path: challenge/dns01/nameserver.go
|
||||
text: (defaultNameservers|recursiveNameservers|fqdnSoaCache|muFqdnSoaCache) is a global variable
|
||||
- linters:
|
||||
linters:
|
||||
- gochecknoglobals
|
||||
path: challenge/dns01/nameserver_.+.go
|
||||
- path: challenge/dns01/nameserver_.+.go
|
||||
text: dnsTimeout is a global variable
|
||||
- linters:
|
||||
linters:
|
||||
- gochecknoglobals
|
||||
path: challenge/dns01/nameserver_test.go
|
||||
- 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
|
||||
linters:
|
||||
- gochecknoglobals
|
||||
- path: challenge/http01/domain_matcher.go
|
||||
text: cyclomatic complexity \d+ of func `parseForwardedHeader` is high
|
||||
- linters:
|
||||
- funlen
|
||||
path: challenge/http01/domain_matcher.go
|
||||
linters:
|
||||
- gocyclo
|
||||
- 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:
|
||||
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:
|
||||
- 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
|
||||
# Those elements have been replaced by non-exposed structures.
|
||||
path: providers/dns/linode/linode_test.go
|
||||
- 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
|
||||
text: 'SA1019: linodego\.(DomainsPagedResponse|DomainRecordsPagedResponse) is deprecated'
|
||||
linters:
|
||||
- staticcheck
|
||||
|
||||
issues:
|
||||
max-issues-per-linter: 0
|
||||
|
|
|
|||
|
|
@ -115,19 +115,19 @@ func NewDNSProviderConfig(config *Config) (*DNSProvider, error) {
|
|||
|
||||
// NewDNSProviderClient creates an ACME-DNS DNSProvider with the given acmeDNSClient and [goacmedns.Storage].
|
||||
// Deprecated: use [NewDNSProviderConfig] instead.
|
||||
func NewDNSProviderClient(client acmeDNSClient, storage goacmedns.Storage) (*DNSProvider, error) {
|
||||
func NewDNSProviderClient(client acmeDNSClient, store goacmedns.Storage) (*DNSProvider, error) {
|
||||
if client == nil {
|
||||
return nil, errors.New("acme-dns: Client must be not nil")
|
||||
}
|
||||
|
||||
if storage == nil {
|
||||
if store == nil {
|
||||
return nil, errors.New("acme-dns: Storage must be not nil")
|
||||
}
|
||||
|
||||
return &DNSProvider{
|
||||
config: NewDefaultConfig(),
|
||||
client: client,
|
||||
storage: storage,
|
||||
storage: store,
|
||||
}, nil
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -46,6 +46,11 @@ func NewDefaultConfig() *Config {
|
|||
}
|
||||
}
|
||||
|
||||
type DNSProvider struct {
|
||||
config *Config
|
||||
acmedns *acmedns.Service
|
||||
}
|
||||
|
||||
// NewDNSProvider returns the Google Domains DNS provider with a default configuration.
|
||||
func NewDNSProvider() (*DNSProvider, error) {
|
||||
values, err := env.Get(EnvAccessToken)
|
||||
|
|
@ -80,11 +85,6 @@ func NewDNSProviderConfig(config *Config) (*DNSProvider, error) {
|
|||
}, nil
|
||||
}
|
||||
|
||||
type DNSProvider struct {
|
||||
config *Config
|
||||
acmedns *acmedns.Service
|
||||
}
|
||||
|
||||
func (d *DNSProvider) Present(domain, token, keyAuth string) error {
|
||||
zone, err := dns01.FindZoneByFqdn(dns01.ToFqdn(domain))
|
||||
if err != nil {
|
||||
|
|
|
|||
|
|
@ -83,10 +83,6 @@ type Config struct {
|
|||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
func (c *Config) hasAppKeyAuth() bool {
|
||||
return c.ApplicationKey != "" || c.ApplicationSecret != "" || c.ConsumerKey != ""
|
||||
}
|
||||
|
||||
// NewDefaultConfig returns a default configuration for the DNSProvider.
|
||||
func NewDefaultConfig() *Config {
|
||||
return &Config{
|
||||
|
|
@ -99,6 +95,10 @@ func NewDefaultConfig() *Config {
|
|||
}
|
||||
}
|
||||
|
||||
func (c *Config) hasAppKeyAuth() bool {
|
||||
return c.ApplicationKey != "" || c.ApplicationSecret != "" || c.ConsumerKey != ""
|
||||
}
|
||||
|
||||
// DNSProvider implements the challenge.Provider interface.
|
||||
type DNSProvider struct {
|
||||
config *Config
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue