diff options
author | ginglis13 <[email protected]> | 2023-10-14 10:19:38 -0700 |
---|---|---|
committer | Ron Evans <[email protected]> | 2023-10-15 12:12:07 +0200 |
commit | 8d77278c6b6eb3dd1d60d0b24c3329dfb7fd289b (patch) | |
tree | 8fabaa8c193cb6299d589ffbbcc021c1df6ca079 /main.go | |
parent | dde9b5ad3aacf2b5fc59aabb0b891876813c145a (diff) | |
download | tinygo-8d77278c6b6eb3dd1d60d0b24c3329dfb7fd289b.tar.gz tinygo-8d77278c6b6eb3dd1d60d0b24c3329dfb7fd289b.zip |
refactor: rm io/ioutil funcs
io/ioutil has been deprecated since Go 1.16
https://pkg.go.dev/io/ioutil
Signed-off-by: ginglis13 <[email protected]>
Diffstat (limited to 'main.go')
-rw-r--r-- | main.go | 11 |
1 files changed, 8 insertions, 3 deletions
@@ -11,7 +11,6 @@ import ( "go/scanner" "go/types" "io" - "io/ioutil" "os" "os/exec" "os/signal" @@ -1736,14 +1735,20 @@ func main() { handleCompilerError(err) case "targets": dir := filepath.Join(goenv.Get("TINYGOROOT"), "targets") - entries, err := ioutil.ReadDir(dir) + entries, err := os.ReadDir(dir) if err != nil { fmt.Fprintln(os.Stderr, "could not list targets:", err) os.Exit(1) return } for _, entry := range entries { - if !entry.Mode().IsRegular() || !strings.HasSuffix(entry.Name(), ".json") { + entryInfo, err := entry.Info() + if err != nil { + fmt.Fprintln(os.Stderr, "could not get entry info:", err) + os.Exit(1) + return + } + if !entryInfo.Mode().IsRegular() || !strings.HasSuffix(entry.Name(), ".json") { // Only inspect JSON files. continue } |