refactor: move from io/ioutil to io and os package
The io/ioutil package has been deprecated as of Go 1.16, see https://golang.org/doc/go1.16#ioutil. This commit replaces the existing io/ioutil functions with their new definitions in io and os packages. Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
This commit is contained in:
@@ -3,7 +3,6 @@ package kubernetes
|
||||
import (
|
||||
"hash"
|
||||
"hash/fnv"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"os"
|
||||
"path/filepath"
|
||||
@@ -72,7 +71,7 @@ func TestInClusterTransport(t *testing.T) {
|
||||
fpath := filepath.Join(os.TempDir(), "test.in_cluster")
|
||||
defer os.RemoveAll(fpath)
|
||||
|
||||
err = ioutil.WriteFile(fpath, []byte("def"), 0o644)
|
||||
err = os.WriteFile(fpath, []byte("def"), 0o644)
|
||||
require.NoError(t, err)
|
||||
|
||||
tests := []struct {
|
||||
@@ -136,7 +135,7 @@ func TestGetClusterConfigNamespace(t *testing.T) {
|
||||
|
||||
var namespaceFile string
|
||||
{
|
||||
tmpfile, err := ioutil.TempFile(os.TempDir(), "test-get-cluster-config-namespace")
|
||||
tmpfile, err := os.CreateTemp(os.TempDir(), "test-get-cluster-config-namespace")
|
||||
require.NoError(t, err)
|
||||
|
||||
_, err = tmpfile.Write([]byte("namespace-from-file"))
|
||||
|
Reference in New Issue
Block a user