Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove references to io/ioutil #89

Merged
merged 1 commit into from
Nov 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions console.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ package runc

import (
"fmt"
"io/ioutil"
"net"
"os"
"path/filepath"
Expand Down Expand Up @@ -54,7 +53,7 @@ func NewConsoleSocket(path string) (*Socket, error) {
// On Close(), the socket is deleted
func NewTempConsoleSocket() (*Socket, error) {
runtimeDir := os.Getenv("XDG_RUNTIME_DIR")
dir, err := ioutil.TempDir(runtimeDir, "pty")
dir, err := os.MkdirTemp(runtimeDir, "pty")
if err != nil {
return nil, err
}
Expand Down
3 changes: 1 addition & 2 deletions runc.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import (
"errors"
"fmt"
"io"
"io/ioutil"
"os"
"os/exec"
"path/filepath"
Expand Down Expand Up @@ -261,7 +260,7 @@ func (r *Runc) Exec(context context.Context, id string, spec specs.Process, opts
if opts.Started != nil {
defer close(opts.Started)
}
f, err := ioutil.TempFile(os.Getenv("XDG_RUNTIME_DIR"), "runc-process")
f, err := os.CreateTemp(os.Getenv("XDG_RUNTIME_DIR"), "runc-process")
if err != nil {
return err
}
Expand Down
3 changes: 1 addition & 2 deletions runc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ package runc
import (
"context"
"errors"
"io/ioutil"
"os"
"sync"
"syscall"
Expand Down Expand Up @@ -290,7 +289,7 @@ func interrupt(ctx context.Context, t *testing.T, started <-chan int) {
// dummySleepRunc creates s simple script that just runs `sleep 10` to replace
// runc for testing process that are longer running.
func dummySleepRunc() (_ string, err error) {
fh, err := ioutil.TempFile("", "*.sh")
fh, err := os.CreateTemp("", "*.sh")
if err != nil {
return "", err
}
Expand Down
4 changes: 2 additions & 2 deletions utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ package runc

import (
"bytes"
"io/ioutil"
"os"
"strconv"
"strings"
"sync"
Expand All @@ -27,7 +27,7 @@ import (
// ReadPidFile reads the pid file at the provided path and returns
// the pid or an error if the read and conversion is unsuccessful
func ReadPidFile(path string) (int, error) {
data, err := ioutil.ReadFile(path)
data, err := os.ReadFile(path)
if err != nil {
return -1, err
}
Expand Down