io/ioutil has already been deprecated in golang 1.16, so replace all ioutil with io and os

This commit is contained in:
ahrtr
2021-10-30 06:41:02 +08:00
parent 2d0fa78f2f
commit fe95aa614c
96 changed files with 250 additions and 297 deletions

View File

@@ -17,7 +17,6 @@ limitations under the License.
package harness
import (
"io/ioutil"
"os"
"testing"
@@ -56,11 +55,11 @@ func (h *Harness) Close() {
}
}
// TempDir is a wrapper around ioutil.TempDir for tests.
// TempDir is a wrapper around os.MkdirTemp for tests.
// It automatically fails the test if we can't create a temp file,
// and deletes the temp directory when Close is called on the Harness
func (h *Harness) TempDir(baseDir string, prefix string) string {
tempDir, err := ioutil.TempDir(baseDir, prefix)
tempDir, err := os.MkdirTemp(baseDir, prefix)
if err != nil {
h.Fatalf("unable to create tempdir: %v", err)
}