Skip to content

Commit 23e1442

Browse files
committed
fix(pkg): stop using outdated ioutil package
1 parent 24a4550 commit 23e1442

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

pkg/engine/config.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package engine
22

33
import (
44
"errors"
5-
"io/ioutil"
5+
"os"
66
"strings"
77

88
"github.com/nicklasfrahm/k3se/pkg/sshx"
@@ -98,7 +98,7 @@ func (c *Config) Verify() error {
9898
// LoadConfig sets up the configuration parser and loads
9999
// the configuration file.
100100
func LoadConfig(configFile string) (*Config, error) {
101-
configBytes, err := ioutil.ReadFile(configFile)
101+
configBytes, err := os.ReadFile(configFile)
102102
if err != nil {
103103
return nil, err
104104
}

pkg/engine/engine.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package engine
33
import (
44
"bytes"
55
"fmt"
6-
"io/ioutil"
6+
"io"
77
"net/http"
88
"net/url"
99
"os"
@@ -309,7 +309,7 @@ func (e *Engine) KubeConfig(outputPath string) error {
309309
}
310310

311311
// Read existing local config.
312-
oldConfigBytes, err := ioutil.ReadFile(outputPath)
312+
oldConfigBytes, err := os.ReadFile(outputPath)
313313
if err != nil {
314314
if !os.IsNotExist(err) {
315315
return err
@@ -354,7 +354,7 @@ func (e *Engine) fetchInstallationScript() ([]byte, error) {
354354
}
355355
defer resp.Body.Close()
356356

357-
e.installer, err = ioutil.ReadAll(resp.Body)
357+
e.installer, err = io.ReadAll(resp.Body)
358358
if err != nil {
359359
return nil, err
360360
}

pkg/sshx/client.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ package sshx
33
import (
44
"errors"
55
"fmt"
6-
"io/ioutil"
76
"net"
7+
"os"
88
"os/user"
99

1010
"github.com/pkg/sftp"
@@ -99,7 +99,7 @@ func (client *Client) normalizeConfig(config *Config) (*ssh.ClientConfig, error)
9999
config.KeyFile = userInfo.HomeDir + config.KeyFile[1:]
100100
}
101101

102-
keyBytes, err := ioutil.ReadFile(config.KeyFile)
102+
keyBytes, err := os.ReadFile(config.KeyFile)
103103
if err != nil {
104104
return nil, err
105105
}

0 commit comments

Comments
 (0)