mirror of https://github.com/stretchr/testify.git
Replace deprecated io/ioutil with io and os
parent
89cbdd9e7b
commit
014ae9a7a4
|
@ -16,7 +16,6 @@ import (
|
||||||
"go/token"
|
"go/token"
|
||||||
"go/types"
|
"go/types"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
"path"
|
"path"
|
||||||
|
@ -101,7 +100,7 @@ func parseTemplates() (*template.Template, *template.Template, error) {
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
if *tmplFile != "" {
|
if *tmplFile != "" {
|
||||||
f, err := ioutil.ReadFile(*tmplFile)
|
f, err := os.ReadFile(*tmplFile)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
@ -183,7 +182,7 @@ func parsePackageSource(pkg string) (*types.Scope, *doc.Package, error) {
|
||||||
files := make(map[string]*ast.File)
|
files := make(map[string]*ast.File)
|
||||||
fileList := make([]*ast.File, len(pd.GoFiles))
|
fileList := make([]*ast.File, len(pd.GoFiles))
|
||||||
for i, fname := range pd.GoFiles {
|
for i, fname := range pd.GoFiles {
|
||||||
src, err := ioutil.ReadFile(path.Join(pd.Dir, fname))
|
src, err := os.ReadFile(path.Join(pd.Dir, fname))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"errors"
|
"errors"
|
||||||
"flag"
|
"flag"
|
||||||
"io/ioutil"
|
"io"
|
||||||
"math/rand"
|
"math/rand"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
|
@ -440,7 +440,7 @@ func (sc *StdoutCapture) StopCapture() (string, error) {
|
||||||
}
|
}
|
||||||
os.Stdout.Close()
|
os.Stdout.Close()
|
||||||
os.Stdout = sc.oldStdout
|
os.Stdout = sc.oldStdout
|
||||||
bytes, err := ioutil.ReadAll(sc.readPipe)
|
bytes, err := io.ReadAll(sc.readPipe)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue