summaryrefslogtreecommitdiff
path: root/src/cmd/internal/archive/archive_test.go
diff options
context:
space:
mode:
authorAndy Pan <panjf2000@gmail.com>2022-08-28 03:38:00 +0800
committerGopher Robot <gobot@golang.org>2022-09-20 02:13:02 +0000
commitf8c659b62ff43e8455ebc675e577b9adc67b3f9f (patch)
tree967f364a5943aa7323224d56a2eb5c969a81ddbe /src/cmd/internal/archive/archive_test.go
parent1e7e160d070443147ee38d4de530ce904637a4f3 (diff)
downloadgo-git-f8c659b62ff43e8455ebc675e577b9adc67b3f9f.tar.gz
all: replace package ioutil with os and io in src
For #45557 Change-Id: I56824135d86452603dd4ed4bab0e24c201bb0683 Reviewed-on: https://go-review.googlesource.com/c/go/+/426257 Run-TryBot: Ian Lance Taylor <iant@google.com> Auto-Submit: Ian Lance Taylor <iant@google.com> Run-TryBot: Andy Pan <panjf2000@gmail.com> Reviewed-by: Cherry Mui <cherryyz@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com>
Diffstat (limited to 'src/cmd/internal/archive/archive_test.go')
-rw-r--r--src/cmd/internal/archive/archive_test.go11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/cmd/internal/archive/archive_test.go b/src/cmd/internal/archive/archive_test.go
index bbaa72cbf8..cca65af8ed 100644
--- a/src/cmd/internal/archive/archive_test.go
+++ b/src/cmd/internal/archive/archive_test.go
@@ -13,7 +13,6 @@ import (
"internal/testenv"
"internal/xcoff"
"io"
- "io/ioutil"
"os"
"os/exec"
"path/filepath"
@@ -43,12 +42,12 @@ func copyDir(dst, src string) error {
if err != nil {
return err
}
- fis, err := ioutil.ReadDir(src)
+ entries, err := os.ReadDir(src)
if err != nil {
return err
}
- for _, fi := range fis {
- err = copyFile(filepath.Join(dst, fi.Name()), filepath.Join(src, fi.Name()))
+ for _, entry := range entries {
+ err = copyFile(filepath.Join(dst, entry.Name()), filepath.Join(src, entry.Name()))
if err != nil {
return err
}
@@ -96,7 +95,7 @@ type goobjPaths struct {
func buildGoobj(t *testing.T) goobjPaths {
buildOnce.Do(func() {
buildErr = func() (err error) {
- buildDir, err = ioutil.TempDir("", "TestGoobj")
+ buildDir, err = os.MkdirTemp("", "TestGoobj")
if err != nil {
return err
}
@@ -132,7 +131,7 @@ func buildGoobj(t *testing.T) goobjPaths {
gopath := filepath.Join(buildDir, "gopath")
err = copyDir(filepath.Join(gopath, "src", "mycgo"), filepath.Join("testdata", "mycgo"))
if err == nil {
- err = ioutil.WriteFile(filepath.Join(gopath, "src", "mycgo", "go.mod"), []byte("module mycgo\n"), 0666)
+ err = os.WriteFile(filepath.Join(gopath, "src", "mycgo", "go.mod"), []byte("module mycgo\n"), 0666)
}
if err != nil {
return err