Skip to content

Commit 72ed29a

Browse files
committed
chore: update go mod deps
1 parent da40f89 commit 72ed29a

File tree

7 files changed

+2138
-348
lines changed

7 files changed

+2138
-348
lines changed

api/client.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@ package api
33
import (
44
"encoding/json"
55
"fmt"
6-
"io/ioutil"
6+
"io"
77
"net/http"
88
"net/url"
9+
"os"
910
"strconv"
1011
"strings"
1112

@@ -50,7 +51,7 @@ func (c *Client) Get(domain string, san []string, onlyCN bool, valid int) (cert
5051
}
5152

5253
if resp.StatusCode != http.StatusOK {
53-
respBody, _ := ioutil.ReadAll(resp.Body)
54+
respBody, _ := io.ReadAll(resp.Body)
5455
return nil, fmt.Errorf("failed to retrieve cert: %s", string(respBody))
5556
}
5657

@@ -80,5 +81,5 @@ func (c *Client) WriteCA(cert *certstore.CertificateResource, filepath string) (
8081
}
8182

8283
func (c *Client) writeFile(data []byte, filepath string) error {
83-
return ioutil.WriteFile(filepath, data, 0644)
84+
return os.WriteFile(filepath, data, 0644)
8485
}

certstore/certstore.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,7 @@ func NewCertStore(acmeDirectory string, email string, challengeProvider challeng
8080
}
8181
// we support only dns challenges
8282
// set our own dns provider
83-
cs.client.Challenge.SetDNS01Provider(challengeProvider)
84-
85-
return cs, nil
83+
return cs, cs.client.Challenge.SetDNS01Provider(challengeProvider)
8684
}
8785

8886
func (c *CertStore) GetUser() (*User, error) {
@@ -103,7 +101,7 @@ func (c *CertStore) GetUser() (*User, error) {
103101
}
104102

105103
user := &User{}
106-
json.Unmarshal(fileUser.Value, user)
104+
err = json.Unmarshal(fileUser.Value, user)
107105
return user, err
108106
}
109107

certstore/libkv/local/local.go

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package local
22

33
import (
4-
"io/ioutil"
54
"os"
65
"path/filepath"
76
"strings"
@@ -57,7 +56,7 @@ func (l *Local) Put(key string, value []byte, opts *store.WriteOptions) error {
5756
if err := l.checkPath(filepath.Dir(path)); err != nil {
5857
return err
5958
}
60-
return ioutil.WriteFile(path, value, 0600)
59+
return os.WriteFile(path, value, 0600)
6160

6261
}
6362

@@ -73,7 +72,7 @@ func (l *Local) Get(key string) (*store.KVPair, error) {
7372
return nil, store.ErrKeyNotFound
7473
}
7574
path := l.absolutePath(key)
76-
value, err := ioutil.ReadFile(path)
75+
value, err := os.ReadFile(path)
7776

7877
return &store.KVPair{Key: key, Value: value, LastIndex: 0}, err
7978
}
@@ -114,20 +113,19 @@ func (l *Local) List(prefix string) ([]*store.KVPair, error) {
114113
return nil
115114
}
116115

117-
pair, err := l.Get(strings.TrimPrefix(path, l.Options.Bucket))
118-
if err == nil {
116+
pair, getErr := l.Get(strings.TrimPrefix(path, l.Options.Bucket))
117+
if getErr == nil {
119118
kv = append(kv, pair)
120119
}
121120

122-
return err
121+
return getErr
123122
})
124123

125124
return kv, err
126125
}
127126

128127
// Close is not required but needs to be implemented
129128
func (l *Local) Close() {
130-
return
131129
}
132130

133131
// DeleteTree remove

certstore/libkv/local/local_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package local
22

33
import (
4-
"io/ioutil"
54
"os"
65
"testing"
76

@@ -42,7 +41,7 @@ func TestRegister(t *testing.T) {
4241
}
4342

4443
func TestLocalStore(t *testing.T) {
45-
tmpdir, err := ioutil.TempDir("", "kvlocaltest")
44+
tmpdir, err := os.MkdirTemp("", "kvlocaltest")
4645

4746
if err != nil {
4847
t.Fatalf("cannot create temp dir: %v", err)

0 commit comments

Comments
 (0)