88 "flag"
99 "fmt"
1010 "go/build"
11- "io/ioutil"
1211 "log"
1312 "os"
1413 "os/exec"
@@ -44,7 +43,7 @@ func writeProgram(importPath string, types []string, values []string) ([]byte, e
4443
4544// run the given program and parse the output as a model.Package.
4645func run (program string ) (* model.PackedPkg , error ) {
47- f , err := ioutil . TempFile ("" , "" )
46+ f , err := os . CreateTemp ("" , "" )
4847 if err != nil {
4948 return nil , err
5049 }
@@ -85,7 +84,7 @@ func run(program string) (*model.PackedPkg, error) {
8584// parses the output as a model.Package.
8685func runInDir (program []byte , dir string ) (* model.PackedPkg , error ) {
8786 // We use TempDir instead of TempFile so we can control the filename.
88- tmpDir , err := ioutil . TempDir (dir , "depstubber_reflect_" )
87+ tmpDir , err := os . MkdirTemp (dir , "depstubber_reflect_" )
8988 if err != nil {
9089 return nil , err
9190 }
@@ -101,7 +100,7 @@ func runInDir(program []byte, dir string) (*model.PackedPkg, error) {
101100 progBinary += ".exe"
102101 }
103102
104- if err := ioutil .WriteFile (filepath .Join (tmpDir , progSource ), program , 0600 ); err != nil {
103+ if err := os .WriteFile (filepath .Join (tmpDir , progSource ), program , 0600 ); err != nil {
105104 return nil , err
106105 }
107106
0 commit comments