runtime: change io/ioutil to io/os packages

Change io/ioutil to io/os packages because io/ioutil package
is deprecated from 1.16:

Discard => io.Discard
NopCloser => io.NopCloser
ReadAll => io.ReadAll
ReadDir => os.ReadDir
ReadFile => os.ReadFile
TempDir => os.MkdirTemp
TempFile => os.CreateTemp
WriteFile => os.WriteFile

Details: https://go.dev/doc/go1.16#ioutil

Fixes: #3265

Signed-off-by: bin <bin@hyper.sh>
This commit is contained in:
bin
2021-12-14 17:41:01 +08:00
parent 24a530ced1
commit 03546f75a6
76 changed files with 260 additions and 317 deletions

View File

@@ -6,7 +6,6 @@
package virtcontainers
import (
"io/ioutil"
"net"
"os"
"reflect"
@@ -87,7 +86,7 @@ func TestIncorrectEndpointTypeString(t *testing.T) {
func TestSaveLoadIfPair(t *testing.T) {
macAddr := net.HardwareAddr{0x02, 0x00, 0xCA, 0xFE, 0x00, 0x04}
tmpfile, err := ioutil.TempFile("", "vc-Save-Load-net-")
tmpfile, err := os.CreateTemp("", "vc-Save-Load-net-")
assert.Nil(t, err)
defer os.Remove(tmpfile.Name())