diff --git a/cmd/ssh-over-vsock/client.go b/cmd/ssh-over-vsock/client.go index 567ceb7f..cca9a864 100644 --- a/cmd/ssh-over-vsock/client.go +++ b/cmd/ssh-over-vsock/client.go @@ -2,8 +2,8 @@ package main import ( "fmt" - "io/ioutil" "net" + "os" "time" "golang.org/x/crypto/ssh" @@ -27,7 +27,7 @@ func newClient(conn net.Conn, user string, key string) (*client, error) { } func newConfig(user string, keyFile string) (*ssh.ClientConfig, error) { - key, err := ioutil.ReadFile(keyFile) + key, err := os.ReadFile(keyFile) if err != nil { return nil, err } diff --git a/pkg/client/client.go b/pkg/client/client.go index c7be3db7..554d2188 100644 --- a/pkg/client/client.go +++ b/pkg/client/client.go @@ -5,7 +5,7 @@ import ( "encoding/json" "errors" "fmt" - "io/ioutil" + "io" "net/http" "strings" @@ -52,7 +52,7 @@ func (c *Client) Expose(req *types.ExposeRequest) error { } defer res.Body.Close() if res.StatusCode != http.StatusOK { - err, readErr := ioutil.ReadAll(res.Body) + err, readErr := io.ReadAll(res.Body) if readErr != nil { return fmt.Errorf("error while reading error message: %v", readErr) } @@ -72,7 +72,7 @@ func (c *Client) Unexpose(req *types.UnexposeRequest) error { } defer res.Body.Close() if res.StatusCode != http.StatusOK { - err, readErr := ioutil.ReadAll(res.Body) + err, readErr := io.ReadAll(res.Body) if readErr != nil { return fmt.Errorf("error while reading error message: %v", readErr) } diff --git a/pkg/sshclient/bastion.go b/pkg/sshclient/bastion.go index 6a17a957..c879bcc3 100644 --- a/pkg/sshclient/bastion.go +++ b/pkg/sshclient/bastion.go @@ -4,7 +4,6 @@ import ( "bufio" "context" "fmt" - "io/ioutil" "net" "net/url" "os" @@ -39,7 +38,7 @@ type Bastion struct { type ConnectCallback func(ctx context.Context, bastion *Bastion) (net.Conn, error) func PublicKey(path string, passphrase []byte) (ssh.Signer, error) { - key, err := ioutil.ReadFile(path) + key, err := os.ReadFile(path) if err != nil { return nil, err } diff --git a/test-win-sshproxy/basic_test.go b/test-win-sshproxy/basic_test.go index 3d94c706..e9541c58 100644 --- a/test-win-sshproxy/basic_test.go +++ b/test-win-sshproxy/basic_test.go @@ -5,7 +5,6 @@ package e2e import ( "context" "io" - "io/ioutil" "net" "net/http" "os" @@ -80,10 +79,10 @@ var _ = Describe("connectivity", func() { reader, err := cmd.StdoutPipe() Expect(err).ShouldNot(HaveOccurred()) cmd.Start() - output, err := ioutil.ReadAll(reader) + output, err := io.ReadAll(reader) Expect(err).ShouldNot(HaveOccurred()) cmd.Wait() Expect(strings.Contains(string(output), `[info ] test: Listening on: \\.\pipe\fake_docker_engine`)).Should(BeTrue()) - Expect(strings.Contains(string(output),`[debug] test: Socket forward established`)).Should(BeTrue()) + Expect(strings.Contains(string(output), `[debug] test: Socket forward established`)).Should(BeTrue()) }) }) diff --git a/test-win-sshproxy/suite_test.go b/test-win-sshproxy/suite_test.go index 4e725475..e671ed14 100644 --- a/test-win-sshproxy/suite_test.go +++ b/test-win-sshproxy/suite_test.go @@ -5,7 +5,6 @@ package e2e import ( "flag" "fmt" - "io/ioutil" "os" "os/exec" "path/filepath" @@ -39,7 +38,7 @@ func init() { flag.StringVar(&binDir, "bin", "../bin", "directory with compiled binaries") _ = os.MkdirAll(tmpDir, 0755) keyFile = filepath.Join(tmpDir, "id.key") - _ = ioutil.WriteFile(keyFile, []byte(fakeHostKey), 0600) + _ = os.WriteFile(keyFile, []byte(fakeHostKey), 0600) winSshProxy = filepath.Join(binDir, "win-sshproxy.exe") tidFile = filepath.Join(tmpDir, "win-sshproxy.tid") } @@ -59,7 +58,7 @@ func startProxy() error { } func readTid() (uint32, uint32, error) { - contents, err := ioutil.ReadFile(tidFile) + contents, err := os.ReadFile(tidFile) if err != nil { return 0, 0, err } diff --git a/test/fcos_amd64.go b/test/fcos_amd64.go index 5d99b6b9..3ffb906e 100644 --- a/test/fcos_amd64.go +++ b/test/fcos_amd64.go @@ -3,7 +3,7 @@ package e2e import ( "encoding/json" "fmt" - "io/ioutil" + "io" "net/http" "github.com/coreos/stream-metadata-go/fedoracoreos" @@ -19,7 +19,7 @@ func getFCOSDownload() (*fcosDownloadInfo, error) { if err != nil { return nil, err } - body, err := ioutil.ReadAll(resp.Body) + body, err := io.ReadAll(resp.Body) if err != nil { return nil, err } diff --git a/test/ignition.go b/test/ignition.go index 523d804d..a9dcbff1 100644 --- a/test/ignition.go +++ b/test/ignition.go @@ -2,8 +2,8 @@ package e2e import ( "encoding/json" - "io/ioutil" "net/url" + "os" ) var ( @@ -142,7 +142,7 @@ ExecStart=/usr/bin/sleep infinity } // #nosec - return ioutil.WriteFile(ignitionFile, contents, 0644) + return os.WriteFile(ignitionFile, contents, 0644) } func dir(path string) Directory { diff --git a/test/suite_test.go b/test/suite_test.go index 0099e08f..35dca606 100644 --- a/test/suite_test.go +++ b/test/suite_test.go @@ -4,7 +4,6 @@ import ( "flag" "fmt" "io" - "io/ioutil" "os" "os/exec" "path/filepath" @@ -176,7 +175,7 @@ func createSSHKeys() (string, error) { } func readPublicKey() (string, error) { - publicKey, err := ioutil.ReadFile(publicKeyFile) + publicKey, err := os.ReadFile(publicKeyFile) if err != nil { return "", nil }