From f8c659b62ff43e8455ebc675e577b9adc67b3f9f Mon Sep 17 00:00:00 2001 From: Andy Pan Date: Sun, 28 Aug 2022 03:38:00 +0800 Subject: 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 Auto-Submit: Ian Lance Taylor Run-TryBot: Andy Pan Reviewed-by: Cherry Mui TryBot-Result: Gopher Robot Reviewed-by: Ian Lance Taylor --- src/cmd/internal/pkgpath/pkgpath.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/cmd/internal/pkgpath/pkgpath.go') 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 } -- cgit v1.3