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

* refactor: move from io/ioutil to io and os package

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>

* chore: remove //nolint:gosec for os.ReadFile

At the time of this commit, the G304 rule of gosec does not include the
`os.ReadFile` function. We remove `//nolint:gosec` temporarily until
https://github.com/securego/gosec/pull/706 is merged.

Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
This commit is contained in:
Eng Zer Jun authored and GitHub committed 2021-10-06 08:39:10 -07:00
1 parent 3bb5b63289
commit 73e492c9db
73 files changed
+158 -191

No files matched your search

+1 -2
View File
@@ -5,7 +5,6 @@
import (
"context"
"io/ioutil"
"os"
"time"
@@ -48,7 +47,7 @@ func Directory(ctx context.Context, entry fs.Directory, mountPoint string, mount
if mountPoint == "*" {
var err error
mountPoint, err = ioutil.TempDir("", "kopia-mount")
mountPoint, err = os.MkdirTemp("", "kopia-mount")
if err != nil {
return nil, errors.Wrap(err, "error creating temp directory")
}