@@ -16,7 +16,6 @@ import (
1616 "go/build"
1717 "io"
1818 "io/fs"
19- "io/ioutil"
2019 "os"
2120 "os/exec"
2221 "path/filepath"
@@ -262,14 +261,14 @@ func RunT(t T, p Params) {
262261 }
263262 testTempDir := p .WorkdirRoot
264263 if testTempDir == "" {
265- testTempDir , err = ioutil . TempDir (os .Getenv ("GOTMPDIR" ), "go-test-script" )
264+ testTempDir , err = os . MkdirTemp (os .Getenv ("GOTMPDIR" ), "go-test-script" )
266265 if err != nil {
267266 t .Fatal (err )
268267 }
269268 } else {
270269 p .TestWork = true
271270 }
272- // The temp dir returned by ioutil.TempDir might be a sym linked dir (default
271+ // The temp dir returned by os.MkdirTemp might be a sym linked dir (default
273272 // behaviour in macOS). That could mess up matching that includes $WORK if,
274273 // for example, an external program outputs resolved paths. Evaluating the
275274 // dir here will ensure consistency.
@@ -780,7 +779,7 @@ func (ts *TestScript) applyScriptUpdates() {
780779 panic ("script update file not found" )
781780 }
782781 }
783- if err := ioutil .WriteFile (ts .file , txtar .Format (ts .archive ), 0o666 ); err != nil {
782+ if err := os .WriteFile (ts .file , txtar .Format (ts .archive ), 0o666 ); err != nil {
784783 ts .t .Fatal ("cannot update script: " , err )
785784 }
786785 ts .Logf ("%s updated" , ts .file )
@@ -1174,7 +1173,7 @@ func (ts *TestScript) ReadFile(file string) string {
11741173 return ts .ttyout
11751174 default :
11761175 file = ts .MkAbs (file )
1177- data , err := ioutil .ReadFile (file )
1176+ data , err := os .ReadFile (file )
11781177 ts .Check (err )
11791178 return string (data )
11801179 }
0 commit comments