Skip to content

Commit 814a58e

Browse files
authored
Merge pull request #89 from austinvazquez/remove-ioutil
Remove references to io/ioutil
2 parents 4faf3b6 + fc700c2 commit 814a58e

File tree

4 files changed

+5
-8
lines changed

4 files changed

+5
-8
lines changed

console.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ package runc
2121

2222
import (
2323
"fmt"
24-
"io/ioutil"
2524
"net"
2625
"os"
2726
"path/filepath"
@@ -54,7 +53,7 @@ func NewConsoleSocket(path string) (*Socket, error) {
5453
// On Close(), the socket is deleted
5554
func NewTempConsoleSocket() (*Socket, error) {
5655
runtimeDir := os.Getenv("XDG_RUNTIME_DIR")
57-
dir, err := ioutil.TempDir(runtimeDir, "pty")
56+
dir, err := os.MkdirTemp(runtimeDir, "pty")
5857
if err != nil {
5958
return nil, err
6059
}

runc.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import (
2323
"errors"
2424
"fmt"
2525
"io"
26-
"io/ioutil"
2726
"os"
2827
"os/exec"
2928
"path/filepath"
@@ -261,7 +260,7 @@ func (r *Runc) Exec(context context.Context, id string, spec specs.Process, opts
261260
if opts.Started != nil {
262261
defer close(opts.Started)
263262
}
264-
f, err := ioutil.TempFile(os.Getenv("XDG_RUNTIME_DIR"), "runc-process")
263+
f, err := os.CreateTemp(os.Getenv("XDG_RUNTIME_DIR"), "runc-process")
265264
if err != nil {
266265
return err
267266
}

runc_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ package runc
1919
import (
2020
"context"
2121
"errors"
22-
"io/ioutil"
2322
"os"
2423
"sync"
2524
"syscall"
@@ -290,7 +289,7 @@ func interrupt(ctx context.Context, t *testing.T, started <-chan int) {
290289
// dummySleepRunc creates s simple script that just runs `sleep 10` to replace
291290
// runc for testing process that are longer running.
292291
func dummySleepRunc() (_ string, err error) {
293-
fh, err := ioutil.TempFile("", "*.sh")
292+
fh, err := os.CreateTemp("", "*.sh")
294293
if err != nil {
295294
return "", err
296295
}

utils.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ package runc
1818

1919
import (
2020
"bytes"
21-
"io/ioutil"
21+
"os"
2222
"strconv"
2323
"strings"
2424
"sync"
@@ -27,7 +27,7 @@ import (
2727
// ReadPidFile reads the pid file at the provided path and returns
2828
// the pid or an error if the read and conversion is unsuccessful
2929
func ReadPidFile(path string) (int, error) {
30-
data, err := ioutil.ReadFile(path)
30+
data, err := os.ReadFile(path)
3131
if err != nil {
3232
return -1, err
3333
}

0 commit comments

Comments
 (0)