mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-23 08:47:56 +01:00
Remove calls to Go's deprecated "io/ioutil"
This commit is contained in:
1 parent
788479dd64
commit
226c476994
31 files changed
+73
-93
No files matched your search
+1
-2
@@ -25,7 +25,6 @@ import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"go/format"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
@@ -64,7 +63,7 @@ func main1() error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return ioutil.WriteFile("data.go", formatted, 0644)
|
||||
return os.WriteFile("data.go", formatted, 0644)
|
||||
}
|
||||
|
||||
var (
|
||||
|
||||
+2
-3
@@ -25,7 +25,6 @@ import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"go/format"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"sort"
|
||||
"strings"
|
||||
@@ -57,11 +56,11 @@ func main1() error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return ioutil.WriteFile("data.go", formatted, 0644)
|
||||
return os.WriteFile("data.go", formatted, 0644)
|
||||
}
|
||||
|
||||
func loadReasons() ([]string, error) {
|
||||
s, err := ioutil.ReadFile("axioms.md")
|
||||
s, err := os.ReadFile("axioms.md")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ package generate
|
||||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
@@ -98,7 +98,7 @@ func checkPackageName(s string) string {
|
||||
func parseFiles(tm *t.Map, filenames []string) (files []*a.File, err error) {
|
||||
if len(filenames) == 0 {
|
||||
const filename = "stdin"
|
||||
src, err := ioutil.ReadAll(os.Stdin)
|
||||
src, err := io.ReadAll(os.Stdin)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -117,7 +117,7 @@ func parseFiles(tm *t.Map, filenames []string) (files []*a.File, err error) {
|
||||
|
||||
func ParseFiles(tm *t.Map, filenames []string, opts *parse.Options) (files []*a.File, err error) {
|
||||
for _, filename := range filenames {
|
||||
src, err := ioutil.ReadFile(filename)
|
||||
src, err := os.ReadFile(filename)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -139,5 +139,5 @@ func resolveUse(usePath string) ([]byte, error) {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return ioutil.ReadFile(filepath.Join(wuffsRoot, "gen", "wuffs", filepath.FromSlash(usePath)))
|
||||
return os.ReadFile(filepath.Join(wuffsRoot, "gen", "wuffs", filepath.FromSlash(usePath)))
|
||||
}
|
||||
Reference in new issue
Block a user