Update ioutil library references to os and io respectively for API and Plugins package (#16330)

No user facing changes so I assume no change log is required
This commit is contained in:
Lance Haig
2023-03-08 17:25:09 +01:00
committed by GitHub
parent 962b65f5bc
commit 0e74431b01
8 changed files with 14 additions and 20 deletions

View File

@@ -4,7 +4,6 @@ import (
"context"
"fmt"
"io"
"io/ioutil"
"os"
"reflect"
"regexp"
@@ -176,7 +175,7 @@ func TestExecFSIsolation(t *testing.T, driver *DriverHarness, taskID string) {
t.Logf("created file in task: %v", tempfile)
// read from host
b, err := ioutil.ReadFile(tempfile)
b, err := os.ReadFile(tempfile)
if !isolated {
require.NoError(t, err)
require.Equal(t, text, strings.TrimSpace(string(b)))

View File

@@ -3,7 +3,6 @@ package testutils
import (
"context"
"fmt"
"io/ioutil"
"os"
"path/filepath"
"runtime"
@@ -116,7 +115,7 @@ func (h *DriverHarness) cleanupCgroup() {
// A cleanup func is returned and should be deferred so as to not leak dirs
// between tests.
func (h *DriverHarness) MkAllocDir(t *drivers.TaskConfig, enableLogs bool) func() {
dir, err := ioutil.TempDir("", "nomad_driver_harness-")
dir, err := os.MkdirTemp("", "nomad_driver_harness-")
require.NoError(h.t, err)
allocDir := allocdir.NewAllocDir(h.logger, dir, t.AllocID)

View File

@@ -4,7 +4,6 @@ import (
"context"
"errors"
"fmt"
"io/ioutil"
"os"
"os/exec"
"strings"
@@ -95,7 +94,7 @@ func (c *Device) Run(args []string) int {
var config []byte
if numArgs == 2 {
var err error
config, err = ioutil.ReadFile(args[1])
config, err = os.ReadFile(args[1])
if err != nil {
c.logger.Error("failed to read config file", "error", err)
return 1