From f8b106ac856ba4722e723a082da04e86292662b7 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Mon, 15 Aug 2022 10:29:30 +0300 Subject: [PATCH] [#1684] *: Fix linter warnings Signed-off-by: Evgenii Stratonikov --- cmd/neofs-adm/internal/modules/morph/initialize_test.go | 3 +-- cmd/neofs-cli/modules/bearer/create.go | 6 +++--- cmd/neofs-cli/modules/session/create.go | 4 ++-- cmd/neofs-cli/modules/session/util.go | 4 ++-- pkg/util/gendoc/gendoc.go | 3 +-- 5 files changed, 9 insertions(+), 11 deletions(-) diff --git a/cmd/neofs-adm/internal/modules/morph/initialize_test.go b/cmd/neofs-adm/internal/modules/morph/initialize_test.go index 2780f6b1f..da316ff6c 100644 --- a/cmd/neofs-adm/internal/modules/morph/initialize_test.go +++ b/cmd/neofs-adm/internal/modules/morph/initialize_test.go @@ -2,7 +2,6 @@ package morph import ( "encoding/hex" - "io/ioutil" "os" "path/filepath" "strconv" @@ -56,7 +55,7 @@ func TestInitialize(t *testing.T) { require.NoError(t, err) protoPath := filepath.Join(walletDir, "proto.yml") - require.NoError(t, ioutil.WriteFile(protoPath, data, os.ModePerm)) + require.NoError(t, os.WriteFile(protoPath, data, os.ModePerm)) v.Set(protoConfigPath, protoPath) // Set to the path or remove the next statement to download from the network. diff --git a/cmd/neofs-cli/modules/bearer/create.go b/cmd/neofs-cli/modules/bearer/create.go index 9f2a4b50b..5d3ac2efe 100644 --- a/cmd/neofs-cli/modules/bearer/create.go +++ b/cmd/neofs-cli/modules/bearer/create.go @@ -4,7 +4,7 @@ import ( "context" "encoding/json" "fmt" - "io/ioutil" + "os" "time" internalclient "github.com/nspcc-dev/neofs-node/cmd/neofs-cli/internal/client" @@ -103,7 +103,7 @@ func createToken(cmd *cobra.Command, _ []string) { eaclPath, _ := cmd.Flags().GetString(eaclFlag) if eaclPath != "" { table := eaclSDK.NewTable() - raw, err := ioutil.ReadFile(eaclPath) + raw, err := os.ReadFile(eaclPath) common.ExitOnErr(cmd, "can't read extended ACL file: %w", err) common.ExitOnErr(cmd, "can't parse extended ACL: %w", json.Unmarshal(raw, table)) b.SetEACLTable(*table) @@ -120,6 +120,6 @@ func createToken(cmd *cobra.Command, _ []string) { } out, _ := cmd.Flags().GetString(outFlag) - err = ioutil.WriteFile(out, data, 0644) + err = os.WriteFile(out, data, 0644) common.ExitOnErr(cmd, "can't write token to file: %w", err) } diff --git a/cmd/neofs-cli/modules/session/create.go b/cmd/neofs-cli/modules/session/create.go index b062f4120..6f0cff8ca 100644 --- a/cmd/neofs-cli/modules/session/create.go +++ b/cmd/neofs-cli/modules/session/create.go @@ -2,7 +2,7 @@ package session import ( "fmt" - "io/ioutil" + "os" "github.com/google/uuid" internalclient "github.com/nspcc-dev/neofs-node/cmd/neofs-cli/internal/client" @@ -77,7 +77,7 @@ func createSession(cmd *cobra.Command, _ []string) { } filename, _ := cmd.Flags().GetString(outFlag) - err = ioutil.WriteFile(filename, data, 0644) + err = os.WriteFile(filename, data, 0644) common.ExitOnErr(cmd, "can't write token to file: %w", err) } diff --git a/cmd/neofs-cli/modules/session/util.go b/cmd/neofs-cli/modules/session/util.go index d9cda5f5a..6a710da80 100644 --- a/cmd/neofs-cli/modules/session/util.go +++ b/cmd/neofs-cli/modules/session/util.go @@ -2,7 +2,7 @@ package session import ( "crypto/ecdsa" - "io/ioutil" + "os" internalclient "github.com/nspcc-dev/neofs-node/cmd/neofs-cli/internal/client" "github.com/nspcc-dev/neofs-node/cmd/neofs-cli/internal/common" @@ -28,7 +28,7 @@ func Prepare(cmd *cobra.Command, cnr cid.ID, obj *oid.ID, key *ecdsa.PrivateKey, var tok session.Object if tokenPath, _ := cmd.Flags().GetString(commonflags.SessionToken); len(tokenPath) != 0 { - data, err := ioutil.ReadFile(tokenPath) + data, err := os.ReadFile(tokenPath) common.ExitOnErr(cmd, "can't read session token: %w", err) if err := tok.Unmarshal(data); err != nil { diff --git a/pkg/util/gendoc/gendoc.go b/pkg/util/gendoc/gendoc.go index 23d62d097..5b591e683 100644 --- a/pkg/util/gendoc/gendoc.go +++ b/pkg/util/gendoc/gendoc.go @@ -3,7 +3,6 @@ package gendoc import ( "errors" "fmt" - "io/ioutil" "os" "path/filepath" "strings" @@ -53,7 +52,7 @@ In this case there is a number of helper functions which can be used: } if len(args) == 2 { - data, err := ioutil.ReadFile(args[1]) + data, err := os.ReadFile(args[1]) if err != nil { return fmt.Errorf("can't read the template '%s': %w", args[1], err) }