all: remove calls to deprecated ioutil package

Fixes produced via semgrep and https://github.com/dgryski/semgrep-go/blob/master/ioutil.yml
This commit is contained in:
Damian Gryski
2022-08-05 12:26:15 -07:00
committed by Ron Evans
parent 13f21477b1
commit edbbca5614
13 changed files with 34 additions and 39 deletions
+1 -1
View File
@@ -83,7 +83,7 @@ func GetCachedGoroot(config *compileopts.Config) (string, error) {
}
// Create a temporary directory to construct the goroot within.
tmpgoroot, err := ioutil.TempDir(goenv.Get("GOCACHE"), cachedGorootName+".tmp")
tmpgoroot, err := os.MkdirTemp(goenv.Get("GOCACHE"), cachedGorootName+".tmp")
if err != nil {
return "", err
}
+1 -2
View File
@@ -13,7 +13,6 @@ import (
"go/token"
"go/types"
"io"
"io/ioutil"
"os"
"os/exec"
"path"
@@ -335,7 +334,7 @@ func (p *Package) OriginalDir() string {
// parseFile is a wrapper around parser.ParseFile.
func (p *Package) parseFile(path string, mode parser.Mode) (*ast.File, error) {
originalPath := p.program.getOriginalPath(path)
data, err := ioutil.ReadFile(path)
data, err := os.ReadFile(path)
if err != nil {
return nil, err
}