chore: update to go1.21 (#2103)
This commit is contained in:
parent
c5a95c4cd0
commit
23824af555
28 changed files with 70 additions and 101 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: v1.55.2
|
||||
GOLANGCI_LINT_VERSION: v1.56.0
|
||||
HUGO_VERSION: '0.117.0'
|
||||
CGO_ENABLED: 0
|
||||
LEGO_E2E_TESTS: CI
|
||||
|
|
|
@ -89,18 +89,9 @@ linters-settings:
|
|||
- name: unreachable-code
|
||||
- name: redefines-builtin-id
|
||||
testifylint:
|
||||
enable:
|
||||
- bool-compare
|
||||
- compares
|
||||
- empty
|
||||
- error-is-as
|
||||
- error-nil
|
||||
- expected-actual
|
||||
- float-compare
|
||||
- len
|
||||
- suite-dont-use-pkg
|
||||
- suite-extra-assert-call
|
||||
- suite-thelper
|
||||
disable:
|
||||
- require-error
|
||||
- go-require
|
||||
|
||||
linters:
|
||||
enable-all: true
|
||||
|
@ -153,12 +144,13 @@ linters:
|
|||
|
||||
issues:
|
||||
exclude-use-default: false
|
||||
max-per-linter: 0
|
||||
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'
|
||||
- 'fmt.Sprintf can be replaced with string addition'
|
||||
exclude-rules:
|
||||
- path: (.+)_test.go
|
||||
linters:
|
||||
|
|
|
@ -16,7 +16,7 @@ func (a *AccountService) New(req acme.Account) (acme.ExtendedAccount, error) {
|
|||
resp, err := a.core.post(a.core.GetDirectory().NewAccountURL, req, &account)
|
||||
location := getLocation(resp)
|
||||
|
||||
if len(location) > 0 {
|
||||
if location != "" {
|
||||
a.core.jws.SetKid(location)
|
||||
}
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@ import (
|
|||
"fmt"
|
||||
"math/big"
|
||||
"net"
|
||||
"slices"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
|
@ -88,7 +89,7 @@ func ParsePEMBundle(bundle []byte) ([]*x509.Certificate, error) {
|
|||
func ParsePEMPrivateKey(key []byte) (crypto.PrivateKey, error) {
|
||||
keyBlockDER, _ := pem.Decode(key)
|
||||
if keyBlockDER == nil {
|
||||
return nil, fmt.Errorf("invalid PEM block")
|
||||
return nil, errors.New("invalid PEM block")
|
||||
}
|
||||
|
||||
if keyBlockDER.Type != "PRIVATE KEY" && !strings.HasSuffix(keyBlockDER.Type, " PRIVATE KEY") {
|
||||
|
@ -268,7 +269,7 @@ func ExtractDomainsCSR(csr *x509.CertificateRequest) []string {
|
|||
|
||||
// loop over the SubjectAltName DNS names
|
||||
for _, sanName := range csr.DNSNames {
|
||||
if containsSAN(domains, sanName) {
|
||||
if slices.Contains(domains, sanName) {
|
||||
// Duplicate; skip this name
|
||||
continue
|
||||
}
|
||||
|
@ -287,15 +288,6 @@ func ExtractDomainsCSR(csr *x509.CertificateRequest) []string {
|
|||
return domains
|
||||
}
|
||||
|
||||
func containsSAN(domains []string, sanName string) bool {
|
||||
for _, existingName := range domains {
|
||||
if existingName == sanName {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func GeneratePemCert(privateKey *rsa.PrivateKey, domain string, extensions []pkix.Extension) ([]byte, error) {
|
||||
derBytes, err := generateDerCert(privateKey, time.Time{}, domain, extensions)
|
||||
if err != nil {
|
||||
|
|
|
@ -34,7 +34,7 @@ func createRenew() *cli.Command {
|
|||
Before: func(ctx *cli.Context) error {
|
||||
// we require either domains or csr, but not both
|
||||
hasDomains := len(ctx.StringSlice("domains")) > 0
|
||||
hasCsr := len(ctx.String("csr")) > 0
|
||||
hasCsr := ctx.String("csr") != ""
|
||||
if hasDomains && hasCsr {
|
||||
log.Fatal("Please specify either --domains/-d or --csr/-c, but not both")
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ func createRun() *cli.Command {
|
|||
Before: func(ctx *cli.Context) error {
|
||||
// we require either domains or csr, but not both
|
||||
hasDomains := len(ctx.StringSlice("domains")) > 0
|
||||
hasCsr := len(ctx.String("csr")) > 0
|
||||
hasCsr := ctx.String("csr") != ""
|
||||
if hasDomains && hasCsr {
|
||||
log.Fatal("Please specify either --domains/-d or --csr/-c, but not both")
|
||||
}
|
||||
|
|
2
go.mod
2
go.mod
|
@ -1,6 +1,6 @@
|
|||
module github.com/go-acme/lego/v4
|
||||
|
||||
go 1.20
|
||||
go 1.21
|
||||
|
||||
// github.com/exoscale/egoscale v1.19.0 => It is an error, please don't use it.
|
||||
|
||||
|
|
14
go.sum
14
go.sum
|
@ -28,9 +28,11 @@ github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0/go.mod h1:okt5dMMTOFjX/aov
|
|||
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dns/armdns v1.1.0 h1:8iR6OLffWWorFdzL2JFCab5xpD8VKEE2DUBBl+HNTDY=
|
||||
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dns/armdns v1.1.0/go.mod h1:copqlcjMWc/wgQ1N2fzsJFQxDdqKGg1EQt8T5wJMOGE=
|
||||
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal v1.1.2 h1:mLY+pNLjCUeKhgnAJWAKhEUQM+RJQo2H1fuGSw1Ky1E=
|
||||
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal v1.1.2/go.mod h1:FbdwsQ2EzwvXxOPcMFYO8ogEc9uMMIj3YkmCdXdAFmk=
|
||||
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/privatedns/armprivatedns v1.1.0 h1:rR8ZW79lE/ppfXTfiYSnMFv5EzmVuY4pfZWIkscIJ64=
|
||||
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/privatedns/armprivatedns v1.1.0/go.mod h1:y2zXtLSMM/X5Mfawq0lOftpWn3f4V6OCsRdINsvWBPI=
|
||||
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.0.0 h1:ECsQtyERDVz3NP3kvDOTLvbQhqWp/x9EsGKtb4ogUr8=
|
||||
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.0.0/go.mod h1:s1tW/At+xHqjNFvWU4G0c0Qv33KOhvbGNj0RCTQDV8s=
|
||||
github.com/Azure/go-autorest v14.2.0+incompatible h1:V5VMDjClD3GiElqLWO7mz2MxNAK/vTfRHdAubSIPRgs=
|
||||
github.com/Azure/go-autorest v14.2.0+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSWATqVooLgysK6ZNox3g/xq24=
|
||||
github.com/Azure/go-autorest/autorest v0.11.24/go.mod h1:G6kyRlFnTuSbEYkQGawPfsCswgme4iYf6rfSKUDzbCc=
|
||||
|
@ -168,6 +170,7 @@ github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8
|
|||
github.com/dimchansky/utfbom v1.1.1 h1:vV6w1AhK4VMnhBno/TPVCoK9U/LP0PkLCS9tbxHdi/U=
|
||||
github.com/dimchansky/utfbom v1.1.1/go.mod h1:SxdoEBH5qIqFocHMyGOXVAybYJdr71b1Q/j0mACtrfE=
|
||||
github.com/dnaeon/go-vcr v1.2.0 h1:zHCHvJYTMh1N7xnV7zf1m1GPBF9Ad0Jk/whtQ1663qI=
|
||||
github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5OLb6RQ=
|
||||
github.com/dnsimple/dnsimple-go v1.2.0 h1:ddTGyLVKly5HKb5L65AkLqFqwZlWo3WnR0BlFZlIddM=
|
||||
github.com/dnsimple/dnsimple-go v1.2.0/go.mod h1:z/cs26v/eiRvUyXsHQBLd8lWF8+cD6GbmkPH84plM4U=
|
||||
github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
|
||||
|
@ -181,6 +184,7 @@ github.com/exoscale/egoscale v0.102.3 h1:DYqN2ipoLKpiFoprRGQkp2av/Ze7sUYYlGhi1N6
|
|||
github.com/exoscale/egoscale v0.102.3/go.mod h1:RPf2Gah6up+6kAEayHTQwqapzXlm93f0VQas/UEGU5c=
|
||||
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
|
||||
github.com/fatih/color v1.13.0 h1:8LOYc1KYPPmyKMuN8QV2DNRWNbLo6LZ0iLs8+mlH53w=
|
||||
github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk=
|
||||
github.com/fatih/structs v1.1.0 h1:Q7juDM0QtcnhCpeyLGQKyg4TOIghuNXrkL32pHAUMxo=
|
||||
github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M=
|
||||
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
|
||||
|
@ -219,6 +223,7 @@ github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg78
|
|||
github.com/go-viper/mapstructure/v2 v2.0.0-alpha.1 h1:TQcrn6Wq+sKGkpyPvppOz99zsMBaUOKXq6HSv655U1c=
|
||||
github.com/go-viper/mapstructure/v2 v2.0.0-alpha.1/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM=
|
||||
github.com/gobs/pretty v0.0.0-20180724170744-09732c25a95b h1:/vQ+oYKu+JoyaMPDsv5FzwuL2wwWBgBbtj/YLCi4LuA=
|
||||
github.com/gobs/pretty v0.0.0-20180724170744-09732c25a95b/go.mod h1:Xo4aNUOrJnVruqWQJBtW6+bTBDTniY8yZum5rF3b5jw=
|
||||
github.com/goccy/go-json v0.7.8/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I=
|
||||
github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU=
|
||||
github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I=
|
||||
|
@ -270,6 +275,7 @@ github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/
|
|||
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE=
|
||||
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
|
||||
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
||||
github.com/google/go-github/v32 v32.1.0/go.mod h1:rIEpZD9CTDQwDK9GDrtMTycQNA4JU3qBsCizh3q2WCI=
|
||||
github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck=
|
||||
github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8=
|
||||
|
@ -317,6 +323,7 @@ github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9n
|
|||
github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48=
|
||||
github.com/hashicorp/go-hclog v0.9.2/go.mod h1:5CU+agLiy3J7N7QjHK5d05KxGsuXiQLrjA0H7acj2lQ=
|
||||
github.com/hashicorp/go-hclog v1.2.0 h1:La19f8d7WIlm4ogzNHB0JGqs5AUDAZ2UfCY4sJXcJdM=
|
||||
github.com/hashicorp/go-hclog v1.2.0/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ=
|
||||
github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60=
|
||||
github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM=
|
||||
github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk=
|
||||
|
@ -347,6 +354,7 @@ github.com/infobloxopen/infoblox-go-client v1.1.1 h1:728A6LbLjptj/7kZjHyIxQnm768
|
|||
github.com/infobloxopen/infoblox-go-client v1.1.1/go.mod h1:BXiw7S2b9qJoM8MS40vfgCNB2NLHGusk1DtO16BD9zI=
|
||||
github.com/jarcoal/httpmock v1.0.8/go.mod h1:ATjnClrvW/3tijVmpL/va5Z3aAyGvqU3gCT8nX0Txik=
|
||||
github.com/jarcoal/httpmock v1.3.0 h1:2RJ8GP0IIaWwcC9Fp2BmVi8Kog3v2Hn7VXM3fTd+nuc=
|
||||
github.com/jarcoal/httpmock v1.3.0/go.mod h1:3yb8rc4BI7TCBhFY8ng0gjuLKJNquuDNiPaZjnENuYg=
|
||||
github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k=
|
||||
github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg=
|
||||
github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo=
|
||||
|
@ -414,6 +422,7 @@ github.com/mattn/go-colorable v0.1.7/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope
|
|||
github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
|
||||
github.com/mattn/go-colorable v0.1.11/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4=
|
||||
github.com/mattn/go-colorable v0.1.12 h1:jF+Du6AlPIjs2BiUiQlKOX0rt3SujHxPnksPKZbaA40=
|
||||
github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4=
|
||||
github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
|
||||
github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
|
||||
github.com/mattn/go-isatty v0.0.10/go.mod h1:qgIWMr58cqv1PHHyhnkY9lrL7etaEgOFcMEpPG5Rm84=
|
||||
|
@ -426,6 +435,7 @@ github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m
|
|||
github.com/mattn/go-tty v0.0.3/go.mod h1:ihxohKRERHTVzN+aSVRwACLCeqIoZAWpoICkkvrWyR0=
|
||||
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
|
||||
github.com/maxatome/go-testdeep v1.12.0 h1:Ql7Go8Tg0C1D/uMMX59LAoYK7LffeJQ6X2T04nTH68g=
|
||||
github.com/maxatome/go-testdeep v1.12.0/go.mod h1:lPZc/HAcJMP92l7yI6TRz1aZN5URwUBUAfUNvrclaNM=
|
||||
github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg=
|
||||
github.com/miekg/dns v1.1.47/go.mod h1:e3IlAVfNqAllflbibAZEWOXOQ+Ynzk/dDozDxY7XnME=
|
||||
github.com/miekg/dns v1.1.58 h1:ca2Hdkz+cDg/7eNF6V56jjzuZ4aCAE+DbVkILdQWG/4=
|
||||
|
@ -540,6 +550,7 @@ github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFR
|
|||
github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc=
|
||||
github.com/rogpeppe/go-internal v1.8.0/go.mod h1:WmiCO8CzOY8rg0OYDC4/i/2WRWAB6poM+XZ2dLUbcbE=
|
||||
github.com/rogpeppe/go-internal v1.8.1 h1:geMPLpDpQOgVyCg5z5GoRwLHepNdb71NXb67XFkP+Eg=
|
||||
github.com/rogpeppe/go-internal v1.8.1/go.mod h1:JeRgkft04UBgHMgCIwADu4Pn6Mtm5d4nPKWu0nJ5d+o=
|
||||
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
||||
github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk=
|
||||
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
||||
|
@ -567,6 +578,7 @@ github.com/smartystreets/go-aws-auth v0.0.0-20180515143844-0c1422d1fdb9 h1:hp2CY
|
|||
github.com/smartystreets/go-aws-auth v0.0.0-20180515143844-0c1422d1fdb9/go.mod h1:SnhjPscd9TpLiy1LpzGSKh3bXCfxxXuqd9xmQJy3slM=
|
||||
github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
|
||||
github.com/smartystreets/gunit v1.0.4 h1:tpTjnuH7MLlqhoD21vRoMZbMIi5GmBsAJDFyF67GhZA=
|
||||
github.com/smartystreets/gunit v1.0.4/go.mod h1:EH5qMBab2UclzXUcpR8b93eHsIlp9u+pDQIRp5DZNzQ=
|
||||
github.com/softlayer/softlayer-go v1.1.3 h1:dfFzt5eOKIAyB/b78fHMyDu5ICx0ZtxL9NRhBlf831A=
|
||||
github.com/softlayer/softlayer-go v1.1.3/go.mod h1:Pc7F57OgUKaAam7TtpqkUeqL7QyKknfiUI4R49h41/U=
|
||||
github.com/softlayer/xmlrpc v0.0.0-20200409220501-5f089df7cb7e h1:3OgWYFw7jxCZPcvAg+4R8A50GZ+CCkARF10lxu2qDsQ=
|
||||
|
@ -750,6 +762,7 @@ golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJ
|
|||
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.6.0 h1:5BMeUDZ7vkXGfEr1x9B4bRcTH4lpkTkpdh0T/J+qjbQ=
|
||||
golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
|
||||
golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
|
@ -809,6 +822,7 @@ golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
|
|||
golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo=
|
||||
golang.org/x/term v0.13.0/go.mod h1:LTmsnFJwVN6bCy1rVCoS+qHT1HhALEFxKncY3WNNh4U=
|
||||
golang.org/x/term v0.16.0 h1:m+B6fahuftsE9qjo0VWp2FW0mB3MTJvR0BaMQrq0pmE=
|
||||
golang.org/x/term v0.16.0/go.mod h1:yn7UURbUtPyrVJPGPq404EukNFxcm/foM+bV/bfcDsY=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
|
||||
|
|
2
platform/config/env/env_test.go
vendored
2
platform/config/env/env_test.go
vendored
|
@ -98,7 +98,7 @@ func TestGetWithFallback(t *testing.T) {
|
|||
t.Parallel()
|
||||
|
||||
value, err := GetWithFallback(test.groups...)
|
||||
if len(test.expected.error) > 0 {
|
||||
if test.expected.error != "" {
|
||||
assert.EqualError(t, err, test.expected.error)
|
||||
} else {
|
||||
require.NoError(t, err)
|
||||
|
|
|
@ -108,7 +108,7 @@ func NewDNSProviderConfig(config *Config) (*DNSProvider, error) {
|
|||
case config.APIKey != "" && config.SecretKey != "":
|
||||
credential = credentials.NewAccessKeyCredential(config.APIKey, config.SecretKey)
|
||||
default:
|
||||
return nil, fmt.Errorf("alicloud: ram role or credentials missing")
|
||||
return nil, errors.New("alicloud: ram role or credentials missing")
|
||||
}
|
||||
|
||||
conf := sdk.NewConfig().WithTimeout(config.HTTPTimeout)
|
||||
|
|
|
@ -3,6 +3,7 @@ package azuredns
|
|||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"net/http"
|
||||
|
@ -13,15 +14,15 @@ import (
|
|||
|
||||
func checkOIDCConfig(config *Config) error {
|
||||
if config.TenantID == "" {
|
||||
return fmt.Errorf("azuredns: TenantID is missing")
|
||||
return errors.New("azuredns: TenantID is missing")
|
||||
}
|
||||
|
||||
if config.ClientID == "" {
|
||||
return fmt.Errorf("azuredns: ClientID is missing")
|
||||
return errors.New("azuredns: ClientID is missing")
|
||||
}
|
||||
|
||||
if config.OIDCToken == "" && config.OIDCTokenFilePath == "" && (config.OIDCRequestURL == "" || config.OIDCRequestToken == "") {
|
||||
return fmt.Errorf("azuredns: OIDCToken, OIDCTokenFilePath or OIDCRequestURL and OIDCRequestToken must be set")
|
||||
return errors.New("azuredns: OIDCToken, OIDCTokenFilePath or OIDCRequestURL and OIDCRequestToken must be set")
|
||||
}
|
||||
|
||||
return nil
|
||||
|
@ -64,7 +65,7 @@ func getOIDCToken(config *Config) (string, error) {
|
|||
|
||||
query, err := url.ParseQuery(req.URL.RawQuery)
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("azuredns: cannot parse OIDC request URL query")
|
||||
return "", errors.New("azuredns: cannot parse OIDC request URL query")
|
||||
}
|
||||
|
||||
if query.Get("audience") == "" {
|
||||
|
|
|
@ -115,7 +115,6 @@ func (d *DNSProvider) Present(domain, token, keyAuth string) error {
|
|||
Type: "TXT",
|
||||
Value: info.Value,
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
return fmt.Errorf("checkdomain: %w", err)
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import (
|
|||
"bytes"
|
||||
"context"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"net/http"
|
||||
|
@ -118,7 +119,7 @@ func (c *Client) do(req *http.Request, result any) error {
|
|||
if tok != nil {
|
||||
req.Header.Set("Authorization", "Bearer "+tok.AccessToken)
|
||||
} else {
|
||||
return fmt.Errorf("not logged in")
|
||||
return errors.New("not logged in")
|
||||
}
|
||||
|
||||
resp, err := c.HTTPClient.Do(req)
|
||||
|
|
|
@ -7,6 +7,7 @@ import (
|
|||
"errors"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"slices"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
|
@ -145,7 +146,7 @@ func (d *DNSProvider) Present(domain, _, keyAuth string) error {
|
|||
var found bool
|
||||
var existingRecord shared.ZoneRecord
|
||||
for _, record := range zoneInfo {
|
||||
if contains(record.DataB64, valueB64) {
|
||||
if slices.Contains(record.DataB64, valueB64) {
|
||||
existingRecord = record
|
||||
found = true
|
||||
break
|
||||
|
@ -219,7 +220,7 @@ func (d *DNSProvider) CleanUp(domain, _, keyAuth string) error {
|
|||
var found bool
|
||||
var existingRecord shared.ZoneRecord
|
||||
for _, record := range zoneInfo {
|
||||
if contains(record.DataB64, valueB64) {
|
||||
if slices.Contains(record.DataB64, valueB64) {
|
||||
existingRecord = record
|
||||
found = true
|
||||
break
|
||||
|
@ -328,12 +329,3 @@ func createClient(config *Config) (apiClient, error) {
|
|||
return nil, fmt.Errorf("unsupported mode: %q", config.Mode)
|
||||
}
|
||||
}
|
||||
|
||||
func contains(values []string, value string) bool {
|
||||
for _, v := range values {
|
||||
if v == value {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ import (
|
|||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
"slices"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
|
@ -146,7 +147,7 @@ func (d *DNSProvider) Present(domain, token, keyAuth string) error {
|
|||
}
|
||||
|
||||
if existingRecord != nil {
|
||||
if contains(existingRecord.Records, info.Value) {
|
||||
if slices.Contains(existingRecord.Records, info.Value) {
|
||||
log.Printf("designate: the record already exists: %s", info.Value)
|
||||
return nil
|
||||
}
|
||||
|
@ -197,15 +198,6 @@ func (d *DNSProvider) CleanUp(domain, token, keyAuth string) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func contains(values []string, value string) bool {
|
||||
for _, v := range values {
|
||||
if v == value {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (d *DNSProvider) createRecord(zoneID, fqdn, value string) error {
|
||||
createOpts := recordsets.CreateOpts{
|
||||
Name: fqdn,
|
||||
|
@ -228,7 +220,7 @@ func (d *DNSProvider) createRecord(zoneID, fqdn, value string) error {
|
|||
}
|
||||
|
||||
func (d *DNSProvider) updateRecord(record *recordsets.RecordSet, value string) error {
|
||||
if contains(record.Records, value) {
|
||||
if slices.Contains(record.Records, value) {
|
||||
log.Printf("skip: the record already exists: %s", value)
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -120,7 +120,7 @@ func (d *DNSProvider) Present(domain, token, keyAuth string) error {
|
|||
}
|
||||
|
||||
if err == nil && record == nil {
|
||||
return fmt.Errorf("edgedns: unknown error")
|
||||
return errors.New("edgedns: unknown error")
|
||||
}
|
||||
|
||||
if record != nil {
|
||||
|
@ -175,11 +175,11 @@ func (d *DNSProvider) CleanUp(domain, token, keyAuth string) error {
|
|||
}
|
||||
|
||||
if existingRec == nil {
|
||||
return fmt.Errorf("edgedns: unknown failure")
|
||||
return errors.New("edgedns: unknown failure")
|
||||
}
|
||||
|
||||
if len(existingRec.Target) == 0 {
|
||||
return fmt.Errorf("edgedns: TXT record is invalid")
|
||||
return errors.New("edgedns: TXT record is invalid")
|
||||
}
|
||||
|
||||
if !containsValue(existingRec.Target, info.Value) {
|
||||
|
|
|
@ -3,6 +3,7 @@ package googledomains
|
|||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"time"
|
||||
|
@ -62,11 +63,11 @@ func NewDNSProvider() (*DNSProvider, error) {
|
|||
// NewDNSProviderConfig returns the Google Domains DNS provider with the provided config.
|
||||
func NewDNSProviderConfig(config *Config) (*DNSProvider, error) {
|
||||
if config == nil {
|
||||
return nil, fmt.Errorf("googledomains: the configuration of the DNS provider is nil")
|
||||
return nil, errors.New("googledomains: the configuration of the DNS provider is nil")
|
||||
}
|
||||
|
||||
if config.AccessToken == "" {
|
||||
return nil, fmt.Errorf("googledomains: access token is missing")
|
||||
return nil, errors.New("googledomains: access token is missing")
|
||||
}
|
||||
|
||||
service, err := acmedns.NewService(context.Background(), option.WithHTTPClient(config.HTTPClient))
|
||||
|
|
|
@ -4,6 +4,7 @@ package iij
|
|||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"slices"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
@ -229,7 +230,7 @@ func splitDomain(domain string, zones []string) (string, string, error) {
|
|||
|
||||
for i := 0; i < len(parts)-1; i++ {
|
||||
zone = strings.Join(parts[i:], ".")
|
||||
if zoneContains(zone, zones) {
|
||||
if slices.Contains(zones, zone) {
|
||||
baseOwner := strings.Join(parts[0:i], ".")
|
||||
if baseOwner != "" {
|
||||
baseOwner = "." + baseOwner
|
||||
|
@ -245,12 +246,3 @@ func splitDomain(domain string, zones []string) (string, string, error) {
|
|||
|
||||
return owner, zone, nil
|
||||
}
|
||||
|
||||
func zoneContains(zone string, zones []string) bool {
|
||||
for _, z := range zones {
|
||||
if zone == z {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
|
|
@ -3,7 +3,6 @@ package loopia
|
|||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/go-acme/lego/v4/providers/dns/loopia/internal"
|
||||
|
@ -47,7 +46,7 @@ func TestDNSProvider_Present(t *testing.T) {
|
|||
{
|
||||
desc: "AddTXTRecord fails",
|
||||
|
||||
addTXTRecordError: fmt.Errorf("unknown error: 'ADDTXT'"),
|
||||
addTXTRecordError: errors.New("unknown error: 'ADDTXT'"),
|
||||
callAddTXTRecord: true,
|
||||
|
||||
expectedError: "loopia: failed to add TXT record: unknown error: 'ADDTXT'",
|
||||
|
@ -55,7 +54,7 @@ func TestDNSProvider_Present(t *testing.T) {
|
|||
{
|
||||
desc: "GetTXTRecords fails",
|
||||
|
||||
getTXTRecordsError: fmt.Errorf("unknown error: 'GETTXT'"),
|
||||
getTXTRecordsError: errors.New("unknown error: 'GETTXT'"),
|
||||
callAddTXTRecord: true,
|
||||
callGetTXTRecords: true,
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@ import (
|
|||
"bytes"
|
||||
"context"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"net/http"
|
||||
|
@ -134,7 +135,7 @@ func (c *Client) do(req *http.Request, result any) error {
|
|||
if tok != nil {
|
||||
req.Header.Set("Authorization", "Bearer "+tok.Token)
|
||||
} else {
|
||||
return fmt.Errorf("not logged in")
|
||||
return errors.New("not logged in")
|
||||
}
|
||||
|
||||
resp, err := c.HTTPClient.Do(req)
|
||||
|
|
|
@ -201,5 +201,5 @@ func (d *DNSProvider) CleanUp(domain, token, keyAuth string) error {
|
|||
}
|
||||
}
|
||||
|
||||
return fmt.Errorf("nicmanager: no record found to clean up")
|
||||
return errors.New("nicmanager: no record found to clean up")
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ import (
|
|||
"errors"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"slices"
|
||||
"time"
|
||||
|
||||
"github.com/go-acme/lego/v4/challenge/dns01"
|
||||
|
@ -118,7 +119,7 @@ func (d *DNSProvider) Present(domain, token, keyAuth string) error {
|
|||
|
||||
// TXT record entry already existing
|
||||
if record != nil {
|
||||
if containsValue(record, info.Value) {
|
||||
if slices.Contains(record.Content, info.Value) {
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -177,7 +178,7 @@ func (d *DNSProvider) CleanUp(domain, token, keyAuth string) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
if !containsValue(record, info.Value) {
|
||||
if !slices.Contains(record.Content, info.Value) {
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -229,13 +230,3 @@ func findRecords(records []internal.Record, name string) *internal.Record {
|
|||
|
||||
return nil
|
||||
}
|
||||
|
||||
func containsValue(record *internal.Record, value string) bool {
|
||||
for _, val := range record.Content {
|
||||
if val == value {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package transip
|
|||
|
||||
import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
|
@ -79,12 +80,12 @@ func (f *fakeClient) Post(request rest.Request) error {
|
|||
|
||||
body, err := request.GetJSONBody()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable get request body")
|
||||
return errors.New("unable get request body")
|
||||
}
|
||||
|
||||
var entry dnsEntryWrapper
|
||||
if err := json.Unmarshal(body, &entry); err != nil {
|
||||
return fmt.Errorf("unable to decode request body")
|
||||
return errors.New("unable to decode request body")
|
||||
}
|
||||
|
||||
f.dnsEntries = append(f.dnsEntries, entry.DNSEntry)
|
||||
|
@ -103,12 +104,12 @@ func (f *fakeClient) Delete(request rest.Request) error {
|
|||
|
||||
body, err := request.GetJSONBody()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable get request body")
|
||||
return errors.New("unable get request body")
|
||||
}
|
||||
|
||||
var entry dnsEntryWrapper
|
||||
if err := json.Unmarshal(body, &entry); err != nil {
|
||||
return fmt.Errorf("unable to decode request body")
|
||||
return errors.New("unable to decode request body")
|
||||
}
|
||||
|
||||
cp := make([]domain.DNSEntry, 0)
|
||||
|
|
|
@ -93,7 +93,7 @@ func NewDNSProviderConfig(config *Config) (*DNSProvider, error) {
|
|||
}
|
||||
|
||||
if config.DNSEndpoint == "" {
|
||||
return nil, fmt.Errorf("vkcloud: DNS endpoint is missing in config")
|
||||
return nil, errors.New("vkcloud: DNS endpoint is missing in config")
|
||||
}
|
||||
|
||||
authOpts := gophercloud.AuthOptions{
|
||||
|
|
|
@ -73,7 +73,7 @@ func NewDNSProviderConfig(config *Config) (*DNSProvider, error) {
|
|||
}
|
||||
|
||||
if config.PddToken == "" {
|
||||
return nil, fmt.Errorf("yandex: credentials missing")
|
||||
return nil, errors.New("yandex: credentials missing")
|
||||
}
|
||||
|
||||
client, err := internal.NewClient(config.PddToken)
|
||||
|
|
|
@ -75,11 +75,11 @@ func NewDNSProviderConfig(config *Config) (*DNSProvider, error) {
|
|||
}
|
||||
|
||||
if config.IamToken == "" {
|
||||
return nil, fmt.Errorf("yandexcloud: some credentials information are missing IAM token")
|
||||
return nil, errors.New("yandexcloud: some credentials information are missing IAM token")
|
||||
}
|
||||
|
||||
if config.FolderID == "" {
|
||||
return nil, fmt.Errorf("yandexcloud: some credentials information are missing folder id")
|
||||
return nil, errors.New("yandexcloud: some credentials information are missing folder id")
|
||||
}
|
||||
|
||||
creds, err := decodeCredentials(config.IamToken)
|
||||
|
|
|
@ -22,7 +22,7 @@ var memcachedHosts = loadMemcachedHosts()
|
|||
|
||||
func loadMemcachedHosts() []string {
|
||||
memcachedHostsStr := os.Getenv("MEMCACHED_HOSTS")
|
||||
if len(memcachedHostsStr) > 0 {
|
||||
if memcachedHostsStr != "" {
|
||||
return strings.Split(memcachedHostsStr, ",")
|
||||
}
|
||||
return nil
|
||||
|
|
|
@ -4,6 +4,7 @@ package s3
|
|||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
|
@ -23,7 +24,7 @@ type HTTPProvider struct {
|
|||
// Credentials must be passed in the environment variables.
|
||||
func NewHTTPProvider(bucket string) (*HTTPProvider, error) {
|
||||
if bucket == "" {
|
||||
return nil, fmt.Errorf("s3: bucket name missing")
|
||||
return nil, errors.New("s3: bucket name missing")
|
||||
}
|
||||
|
||||
ctx := context.Background()
|
||||
|
|
Loading…
Reference in a new issue