@@ -6,7 +6,7 @@ package integration
66import (
77 "context"
88 "fmt"
9- "io/ioutil "
9+ "io"
1010 "os"
1111 "path/filepath"
1212 "strings"
@@ -495,7 +495,7 @@ func setup(t *testing.T, options setupOptions) (*cli.App, string, string) {
495495 go func () {
496496 // Setup CLI App
497497 app := commands .NewApp (version )
498- app .Writer = ioutil .Discard
498+ app .Writer = io .Discard
499499 osArgs := setupServer (addr , options .token , options .tokenHeader , cacheDir , options .cacheBackend )
500500
501501 // Run Trivy server
@@ -508,7 +508,7 @@ func setup(t *testing.T, options setupOptions) (*cli.App, string, string) {
508508
509509 // Setup CLI App
510510 app := commands .NewApp (version )
511- app .Writer = ioutil .Discard
511+ app .Writer = io .Discard
512512
513513 return app , addr , cacheDir
514514}
@@ -549,10 +549,10 @@ func setupClient(t *testing.T, c args, addr string, cacheDir string, golden stri
549549 var err error
550550 var ignoreTmpDir string
551551 if len (c .IgnoreIDs ) != 0 {
552- ignoreTmpDir , err = ioutil . TempDir ("" , "ignore" )
552+ ignoreTmpDir , err = os . MkdirTemp ("" , "ignore" )
553553 require .NoError (t , err , "failed to create a temp dir" )
554554 trivyIgnore := filepath .Join (ignoreTmpDir , ".trivyignore" )
555- err = ioutil .WriteFile (trivyIgnore , []byte (strings .Join (c .IgnoreIDs , "\n " )), 0444 )
555+ err = os .WriteFile (trivyIgnore , []byte (strings .Join (c .IgnoreIDs , "\n " )), 0444 )
556556 require .NoError (t , err , "failed to write .trivyignore" )
557557 osArgs = append (osArgs , []string {"--ignorefile" , trivyIgnore }... )
558558 }
@@ -568,7 +568,7 @@ func setupClient(t *testing.T, c args, addr string, cacheDir string, golden stri
568568 if * update {
569569 outputFile = golden
570570 } else {
571- output , _ := ioutil . TempFile ("" , "integration" )
571+ output , _ := os . CreateTemp ("" , "integration" )
572572 assert .Nil (t , output .Close ())
573573 outputFile = output .Name ()
574574 }
@@ -615,9 +615,9 @@ func setupRedis(t *testing.T, ctx context.Context) (testcontainers.Container, st
615615func compare (t * testing.T , wantFile , gotFile string ) {
616616 t .Helper ()
617617 // Compare want and got
618- want , err := ioutil .ReadFile (wantFile )
618+ want , err := os .ReadFile (wantFile )
619619 assert .NoError (t , err )
620- got , err := ioutil .ReadFile (gotFile )
620+ got , err := os .ReadFile (gotFile )
621621 assert .NoError (t , err )
622622
623623 if strings .HasSuffix (wantFile , ".json.golden" ) {
0 commit comments