aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/internal/pkgpath/pkgpath.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/pkgpath/pkgpath.go
parent1e7e160d070443147ee38d4de530ce904637a4f3 (diff)
downloadgo-f8c659b62ff43e8455ebc675e577b9adc67b3f9f.tar.xz
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/pkgpath/pkgpath.go')
-rw-r--r--src/cmd/internal/pkgpath/pkgpath.go7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/cmd/internal/pkgpath/pkgpath.go b/src/cmd/internal/pkgpath/pkgpath.go
index e3c76dced4..0bec137a70 100644
--- a/src/cmd/internal/pkgpath/pkgpath.go
+++ b/src/cmd/internal/pkgpath/pkgpath.go
@@ -10,7 +10,6 @@ import (
"bytes"
"errors"
"fmt"
- "io/ioutil"
"os"
"os/exec"
"strings"
@@ -19,7 +18,7 @@ import (
// ToSymbolFunc returns a function that may be used to convert a
// package path into a string suitable for use as a symbol.
// cmd is the gccgo/GoLLVM compiler in use, and tmpdir is a temporary
-// directory to pass to ioutil.TempFile.
+// directory to pass to os.CreateTemp().
// For example, this returns a function that converts "net/http"
// into a string like "net..z2fhttp". The actual string varies for
// different gccgo/GoLLVM versions, which is why this returns a function
@@ -32,7 +31,7 @@ func ToSymbolFunc(cmd, tmpdir string) (func(string) string, error) {
// the same string. More recent versions use a new mangler
// that avoids these collisions.
const filepat = "*_gccgo_manglechck.go"
- f, err := ioutil.TempFile(tmpdir, filepat)
+ f, err := os.CreateTemp(tmpdir, filepat)
if err != nil {
return nil, err
}
@@ -40,7 +39,7 @@ func ToSymbolFunc(cmd, tmpdir string) (func(string) string, error) {
f.Close()
defer os.Remove(gofilename)
- if err := ioutil.WriteFile(gofilename, []byte(mangleCheckCode), 0644); err != nil {
+ if err := os.WriteFile(gofilename, []byte(mangleCheckCode), 0644); err != nil {
return nil, err
}