all: Remove usage of deprecated io/ioutil (#7971)

As of Go 1.16 io/ioutil is deprecated. This replaces usage with the
corresponding functions in package os and package io.
This commit is contained in:
Jakob Borg
2021-11-22 08:59:47 +01:00
committed by GitHub
parent bf89bffb0b
commit 4b750b6dc3
71 changed files with 190 additions and 235 deletions
+5 -4
View File
@@ -11,8 +11,9 @@ package integration
import (
"bytes"
"io/ioutil"
"io"
"net/http"
"os"
"strings"
"testing"
@@ -33,7 +34,7 @@ func TestHTTPGetIndex(t *testing.T) {
if res.StatusCode != 200 {
t.Errorf("Status %d != 200", res.StatusCode)
}
bs, err := ioutil.ReadAll(res.Body)
bs, err := io.ReadAll(res.Body)
if err != nil {
t.Fatal(err)
}
@@ -57,7 +58,7 @@ func TestHTTPGetIndex(t *testing.T) {
if res.StatusCode != 200 {
t.Errorf("Status %d != 200", res.StatusCode)
}
bs, err = ioutil.ReadAll(res.Body)
bs, err = io.ReadAll(res.Body)
if err != nil {
t.Fatal(err)
}
@@ -222,7 +223,7 @@ func setupAPIBench() *rc.Process {
panic(err)
}
err = ioutil.WriteFile("s1/knownfile", []byte("somedatahere"), 0644)
err = os.WriteFile("s1/knownfile", []byte("somedatahere"), 0644)
if err != nil {
panic(err)
}