aboutsummaryrefslogtreecommitdiffstats
path: root/vm
diff options
context:
space:
mode:
authorTaras Madan <tarasmadan@google.com>2023-02-23 14:28:18 +0100
committerGitHub <noreply@github.com>2023-02-23 14:28:18 +0100
commit4359978ef22a22ddd5a19adf18cbc80cb44244fb (patch)
tree7952da94e27417b39ddf952d9e0bab431dafc4c5 /vm
parent9e2ebb3c174f1e168bc1fbadd5f02f2e25e314fc (diff)
all: ioutil is deprecated in go1.19 (#3718)
Diffstat (limited to 'vm')
-rw-r--r--vm/adb/adb.go5
-rw-r--r--vm/gce/gce.go3
-rwxr-xr-xvm/isolated/isolated.go9
3 files changed, 7 insertions, 10 deletions
diff --git a/vm/adb/adb.go b/vm/adb/adb.go
index 44bdc040d..b63331cc8 100644
--- a/vm/adb/adb.go
+++ b/vm/adb/adb.go
@@ -11,7 +11,6 @@ import (
"encoding/json"
"fmt"
"io"
- "io/ioutil"
"os"
"os/exec"
"path/filepath"
@@ -251,7 +250,7 @@ func findConsoleImpl(adb, dev string) (string, error) {
<-done
tty.Close()
}()
- *out, _ = ioutil.ReadAll(tty)
+ *out, _ = io.ReadAll(tty)
errors <- nil
}(con)
}
@@ -409,7 +408,7 @@ func (inst *instance) repair() error {
func (inst *instance) runScript(script string) error {
log.Logf(2, "adb: executing %s", script)
// Execute the contents of the script.
- contents, err := ioutil.ReadFile(script)
+ contents, err := os.ReadFile(script)
if err != nil {
return fmt.Errorf("unable to read %s: %v", script, err)
}
diff --git a/vm/gce/gce.go b/vm/gce/gce.go
index ba05af51b..458b6ed0f 100644
--- a/vm/gce/gce.go
+++ b/vm/gce/gce.go
@@ -17,7 +17,6 @@ import (
"compress/gzip"
"fmt"
"io"
- "io/ioutil"
"os"
"path/filepath"
"strings"
@@ -149,7 +148,7 @@ func (pool *Pool) Create(workdir string, index int) (vmimpl.Instance, error) {
if out, err := keygen.CombinedOutput(); err != nil {
return nil, fmt.Errorf("failed to execute ssh-keygen: %v\n%s", err, out)
}
- gceKeyPub, err := ioutil.ReadFile(gceKey + ".pub")
+ gceKeyPub, err := os.ReadFile(gceKey + ".pub")
if err != nil {
return nil, fmt.Errorf("failed to read file: %v", err)
}
diff --git a/vm/isolated/isolated.go b/vm/isolated/isolated.go
index 5bff5f1c0..922dea482 100755
--- a/vm/isolated/isolated.go
+++ b/vm/isolated/isolated.go
@@ -7,7 +7,6 @@ import (
"bytes"
"fmt"
"io"
- "io/ioutil"
"os"
"path/filepath"
"strconv"
@@ -187,7 +186,7 @@ func (inst *instance) ssh(command string) error {
}()
if err := cmd.Wait(); err != nil {
close(done)
- out, _ := ioutil.ReadAll(rpipe)
+ out, _ := io.ReadAll(rpipe)
if inst.debug {
log.Logf(0, "ssh failed: %v\n%s", err, out)
}
@@ -224,11 +223,11 @@ func (inst *instance) repair() error {
if len(inst.cfg.USBDevNums) > 0 {
log.Logf(2, "isolated: trying to reboot by USB authorization")
usbAuth := fmt.Sprintf("%s%s%s", "/sys/bus/usb/devices/", inst.cfg.USBDevNums[inst.index], "/authorized")
- if err := ioutil.WriteFile(usbAuth, []byte("0"), 0); err != nil {
+ if err := os.WriteFile(usbAuth, []byte("0"), 0); err != nil {
log.Logf(2, "isolated: failed to turn off the device")
return err
}
- if err := ioutil.WriteFile(usbAuth, []byte("1"), 0); err != nil {
+ if err := os.WriteFile(usbAuth, []byte("1"), 0); err != nil {
log.Logf(2, "isolated: failed to turn on the device")
return err
}
@@ -243,7 +242,7 @@ func (inst *instance) repair() error {
if inst.cfg.StartupScript != "" {
log.Logf(2, "isolated: executing startup_script")
// Execute the contents of the StartupScript on the DUT.
- contents, err := ioutil.ReadFile(inst.cfg.StartupScript)
+ contents, err := os.ReadFile(inst.cfg.StartupScript)
if err != nil {
return fmt.Errorf("unable to read startup_script: %v", err)
}