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

Replace depreciated functions from ioutils package #218

Merged
merged 1 commit into from
Nov 4, 2024
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 backend_qemu.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ package fakemachine
import (
"bytes"
"fmt"
"io/ioutil"
"os"
"os/exec"
"path"
Expand Down Expand Up @@ -85,7 +84,7 @@ func (b qemuBackend) KernelRelease() (string, error) {
return release, nil
}

files, err := ioutil.ReadDir("/lib/modules")
files, err := os.ReadDir("/lib/modules")
if err != nil {
return "", err
}
Expand Down
3 changes: 1 addition & 2 deletions backend_uml.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ package fakemachine
import (
"errors"
"fmt"
"io/ioutil"
"os"
"os/exec"
"path"
Expand Down Expand Up @@ -71,7 +70,7 @@ func (b umlBackend) ModulePath() (string, error) {
}

// find the subdirectory containing the modules for the UML release
modSubdirs, err := ioutil.ReadDir(moddir)
modSubdirs, err := os.ReadDir(moddir)
if err != nil {
return "", err
}
Expand Down
8 changes: 4 additions & 4 deletions machine.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"errors"
"fmt"
"github.com/alessio/shellescape"
"io/ioutil"
"io"
"os"
"os/exec"
"path"
Expand Down Expand Up @@ -609,7 +609,7 @@ func (m *Machine) setupscratch() error {
return nil
}

tmpfile, err := ioutil.TempFile(m.scratchpath, "fake-scratch.img.")
tmpfile, err := os.CreateTemp(m.scratchpath, "fake-scratch.img.")
if err != nil {
return err
}
Expand Down Expand Up @@ -659,7 +659,7 @@ func (m *Machine) startup(command string, extracontent [][2]string) (int, error)
}
}

tmpdir, err := ioutil.TempDir("", "fakemachine-")
tmpdir, err := os.MkdirTemp("", "fakemachine-")
if err != nil {
return -1, err
}
Expand Down Expand Up @@ -902,7 +902,7 @@ func (m *Machine) startup(command string, extracontent [][2]string) (int, error)
return -1, err
}

exitstr, _ := ioutil.ReadAll(result)
exitstr, _ := io.ReadAll(result)
exitcode, err := strconv.Atoi(strings.TrimSpace(string(exitstr)))

if err != nil {
Expand Down
Loading