refactor: move from io/ioutil to io and os package (#1245)

The io/ioutil package has been deprecated as of Go 1.16, see
https://golang.org/doc/go1.16#ioutil. This commit replaces the existing
io/ioutil functions with their new definitions in io and os packages.

Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
This commit is contained in:
Eng Zer Jun
2021-09-29 15:17:02 +08:00
committed by GitHub
parent 6bcb4af10f
commit bbcce9f7b7
13 changed files with 42 additions and 52 deletions

View File

@@ -3,7 +3,6 @@ package commands
import (
"bytes"
"encoding/json"
"io/ioutil"
"os"
"path/filepath"
"testing"
@@ -81,7 +80,7 @@ Vulnerability DB:
case tt.args.cacheDir != "":
cacheDir = tt.args.cacheDir
default:
cacheDir, _ = ioutil.TempDir("", "Test_showVersion-*")
cacheDir, _ = os.MkdirTemp("", "Test_showVersion-*")
defer os.RemoveAll(cacheDir)
}