fix: use of ioutil package (#5261)
* fix ioutil.NopCloser * fix ioutil.ReadAll * fix ioutil.ReadFile * fix ioutil.WriteFile * run goimports -w -format-only ./ * update CHANGELOG.md
This commit is contained in:
5
client/cache/file.go
vendored
5
client/cache/file.go
vendored
@@ -23,7 +23,6 @@ import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strconv"
|
||||
@@ -295,7 +294,7 @@ func exists(path string) (bool, error) {
|
||||
// FileGetContents Reads bytes from a file.
|
||||
// if non-existent, create this file.
|
||||
func FileGetContents(filename string) ([]byte, error) {
|
||||
data, err := ioutil.ReadFile(filename)
|
||||
data, err := os.ReadFile(filename)
|
||||
if err != nil {
|
||||
return nil, berror.Wrapf(err, ReadFileCacheContentFailed,
|
||||
"could not read the data from the file: %s, "+
|
||||
@@ -307,7 +306,7 @@ func FileGetContents(filename string) ([]byte, error) {
|
||||
// FilePutContents puts bytes into a file.
|
||||
// if non-existent, create this file.
|
||||
func FilePutContents(filename string, content []byte) error {
|
||||
return ioutil.WriteFile(filename, content, os.ModePerm)
|
||||
return os.WriteFile(filename, content, os.ModePerm)
|
||||
}
|
||||
|
||||
// GobEncode Gob encodes a file cache item.
|
||||
|
||||
1
client/cache/write_delete.go
vendored
1
client/cache/write_delete.go
vendored
@@ -18,6 +18,7 @@ import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
"github.com/beego/beego/v2/core/berror"
|
||||
)
|
||||
|
||||
|
||||
3
client/cache/write_delete_test.go
vendored
3
client/cache/write_delete_test.go
vendored
@@ -19,10 +19,11 @@ import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
||||
"github.com/beego/beego/v2/core/berror"
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user