Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions benchmark/data.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
package benchmark

import (
"io/ioutil"
"os"
)

var largeStructText, _ = ioutil.ReadFile("example.json")
var largeStructText, _ = os.ReadFile("example.json")
var xlStructData XLStruct

func init() {
Expand Down
7 changes: 3 additions & 4 deletions bootstrap/bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ package bootstrap
import (
"fmt"
"go/format"
"io/ioutil"
"os"
"os/exec"
"path/filepath"
Expand Down Expand Up @@ -88,7 +87,7 @@ func (g *Generator) writeStub() error {

// writeMain creates a .go file that launches the generator if 'go run'.
func (g *Generator) writeMain() (path string, err error) {
f, err := ioutil.TempFile(filepath.Dir(g.OutName), "easyjson-bootstrap")
f, err := os.CreateTemp(filepath.Dir(g.OutName), "easyjson-bootstrap-*")
if err != nil {
return "", err
}
Expand Down Expand Up @@ -211,13 +210,13 @@ func (g *Generator) Run() error {
}

// format file and write to out path
in, err := ioutil.ReadFile(f.Name())
in, err := os.ReadFile(f.Name())
if err != nil {
return err
}
out, err := format.Source(in)
if err != nil {
return err
}
return ioutil.WriteFile(g.OutName, out, 0644)
return os.WriteFile(g.OutName, out, 0644)
}
3 changes: 1 addition & 2 deletions helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package easyjson

import (
"io"
"io/ioutil"
"net/http"
"strconv"
"unsafe"
Expand Down Expand Up @@ -109,7 +108,7 @@ func Unmarshal(data []byte, v Unmarshaler) error {

// UnmarshalFromReader reads all the data in the reader and decodes as JSON into the object.
func UnmarshalFromReader(r io.Reader, v Unmarshaler) error {
data, err := ioutil.ReadAll(r)
data, err := io.ReadAll(r)
if err != nil {
return err
}
Expand Down
3 changes: 1 addition & 2 deletions parser/pkgpath.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"bytes"
"fmt"
"go/build"
"io/ioutil"
"os"
"os/exec"
"path"
Expand Down Expand Up @@ -111,7 +110,7 @@ func getModulePath(goModPath string) string {
pkgPathFromGoModCache.Unlock()
}()

data, err := ioutil.ReadFile(goModPath)
data, err := os.ReadFile(goModPath)
if err != nil {
return ""
}
Expand Down