@@ -3,7 +3,6 @@ package main
33import (
44 "bufio"
55 "fmt"
6- "io/ioutil"
76 "log"
87 "net/url"
98 "os"
@@ -278,7 +277,7 @@ func fixGoVendorIssues(modMode ModMode, depMode DependencyInstallerMode, goDirec
278277 if depMode == GoGetWithModules {
279278 if ! goDirectiveFound {
280279 // if the go.mod does not contain a version line
281- modulesTxt , err := ioutil .ReadFile ("vendor/modules.txt" )
280+ modulesTxt , err := os .ReadFile ("vendor/modules.txt" )
282281 if err != nil {
283282 log .Println ("Failed to read vendor/modules.txt to check for mismatched Go version" )
284283 } else if explicitRe := regexp .MustCompile ("(?m)^## explicit$" ); ! explicitRe .Match (modulesTxt ) {
@@ -365,7 +364,7 @@ type moveGopathInfo struct {
365364func moveToTemporaryGopath (srcdir string , importpath string ) moveGopathInfo {
366365 // a temporary directory where everything is moved while the correct
367366 // directory structure is created.
368- scratch , err := ioutil . TempDir (srcdir , "scratch" )
367+ scratch , err := os . MkdirTemp (srcdir , "scratch" )
369368 if err != nil {
370369 log .Fatalf ("Failed to create temporary directory %s in directory %s: %s\n " ,
371370 scratch , srcdir , err .Error ())
@@ -431,7 +430,7 @@ func createPathTransformerFile(newdir string) *os.File {
431430
432431 // set up SEMMLE_PATH_TRANSFORMER to ensure paths in the source archive and the snapshot
433432 // match the original source location, not the location we moved it to
434- pt , err := ioutil . TempFile ("" , "path-transformer" )
433+ pt , err := os . CreateTemp ("" , "path-transformer" )
435434 if err != nil {
436435 log .Fatalf ("Unable to create path transformer file: %s." , err .Error ())
437436 }
@@ -506,7 +505,7 @@ func buildWithCustomCommands(inst string) {
506505 ext = ".sh"
507506 header = "#! /bin/bash\n set -xe +u\n "
508507 }
509- script , err := ioutil . TempFile ("" , "go-build-command-*" + ext )
508+ script , err := os . CreateTemp ("" , "go-build-command-*" + ext )
510509 if err != nil {
511510 log .Fatalf ("Unable to create temporary script holding custom build commands: %s\n " , err .Error ())
512511 }
@@ -619,7 +618,7 @@ func installDependenciesAndBuild() {
619618 }
620619 if depMode == GoGetWithModules {
621620 versionRe := regexp .MustCompile (`(?m)^go[ \t\r]+([0-9]+\.[0-9]+)$` )
622- goMod , err := ioutil .ReadFile ("go.mod" )
621+ goMod , err := os .ReadFile ("go.mod" )
623622 if err != nil {
624623 log .Println ("Failed to read go.mod to check for missing Go version" )
625624 } else {
0 commit comments