aboutsummaryrefslogtreecommitdiffhomepage
path: root/loader
diff options
context:
space:
mode:
authorDamian Gryski <[email protected]>2022-08-05 12:26:15 -0700
committerRon Evans <[email protected]>2022-08-07 10:32:23 +0200
commitedbbca5614fc5694d0c631cbcea73c7e2e90b336 (patch)
treecf46bf79f6a7edbb3d4966d8a93d50950d1347ca /loader
parent13f21477b118e3f410a196cafcf2e46823e8ba61 (diff)
downloadtinygo-edbbca5614fc5694d0c631cbcea73c7e2e90b336.tar.gz
tinygo-edbbca5614fc5694d0c631cbcea73c7e2e90b336.zip
all: remove calls to deprecated ioutil package
Fixes produced via semgrep and https://github.com/dgryski/semgrep-go/blob/master/ioutil.yml
Diffstat (limited to 'loader')
-rw-r--r--loader/goroot.go2
-rw-r--r--loader/loader.go3
2 files changed, 2 insertions, 3 deletions
diff --git a/loader/goroot.go b/loader/goroot.go
index a012fc19f..5039ed295 100644
--- a/loader/goroot.go
+++ b/loader/goroot.go
@@ -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
}
diff --git a/loader/loader.go b/loader/loader.go
index 730eb7017..6f49982db 100644
--- a/loader/loader.go
+++ b/loader/loader.go
@@ -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
}