From a92188e5f9bef9c426c5d09826afd4ee1bcc01c2 Mon Sep 17 00:00:00 2001 From: Anton Nikiforov Date: Thu, 1 Feb 2024 16:00:45 +0300 Subject: [PATCH] [#932] adm: Reduce methods visibility in `util` package Signed-off-by: Anton Nikiforov --- .../internal/modules/morph/util/initialize_ctx.go | 4 ++-- cmd/frostfs-adm/internal/modules/morph/util/util.go | 6 +++--- cmd/frostfs-adm/internal/modules/morph/util/wallet.go | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/cmd/frostfs-adm/internal/modules/morph/util/initialize_ctx.go b/cmd/frostfs-adm/internal/modules/morph/util/initialize_ctx.go index e7ced2ae..4305df1e 100644 --- a/cmd/frostfs-adm/internal/modules/morph/util/initialize_ctx.go +++ b/cmd/frostfs-adm/internal/modules/morph/util/initialize_ctx.go @@ -88,7 +88,7 @@ func NewInitializeContext(cmd *cobra.Command, v *viper.Viper) (*InitializeContex needContracts := cmd.Name() == "update-contracts" || cmd.Name() == "init" var w *wallet.Wallet - w, err = GetWallet(cmd, v, needContracts, walletDir) + w, err = getWallet(cmd, v, needContracts, walletDir) if err != nil { return nil, err } @@ -249,7 +249,7 @@ func readContracts(c *InitializeContext, names []string) error { } defer r.Close() - m, err := ReadContractsFromArchive(r, names) + m, err := readContractsFromArchive(r, names) if err != nil { return err } diff --git a/cmd/frostfs-adm/internal/modules/morph/util/util.go b/cmd/frostfs-adm/internal/modules/morph/util/util.go index abd72b04..4a963d3d 100644 --- a/cmd/frostfs-adm/internal/modules/morph/util/util.go +++ b/cmd/frostfs-adm/internal/modules/morph/util/util.go @@ -20,7 +20,7 @@ import ( ) func GetAlphabetWallets(v *viper.Viper, walletDir string) ([]*wallet.Wallet, error) { - wallets, err := OpenAlphabetWallets(v, walletDir) + wallets, err := openAlphabetWallets(v, walletDir) if err != nil { return nil, err } @@ -31,7 +31,7 @@ func GetAlphabetWallets(v *viper.Viper, walletDir string) ([]*wallet.Wallet, err return wallets, nil } -func OpenAlphabetWallets(v *viper.Viper, walletDir string) ([]*wallet.Wallet, error) { +func openAlphabetWallets(v *viper.Viper, walletDir string) ([]*wallet.Wallet, error) { walletFiles, err := os.ReadDir(walletDir) if err != nil { return nil, fmt.Errorf("can't read alphabet wallets dir: %w", err) @@ -107,7 +107,7 @@ func ReadContract(ctrPath, ctrName string) (*ContractState, error) { return cs, cs.Parse() } -func ReadContractsFromArchive(file io.Reader, names []string) (map[string]*ContractState, error) { +func readContractsFromArchive(file io.Reader, names []string) (map[string]*ContractState, error) { m := make(map[string]*ContractState, len(names)) for i := range names { m[names[i]] = new(ContractState) diff --git a/cmd/frostfs-adm/internal/modules/morph/util/wallet.go b/cmd/frostfs-adm/internal/modules/morph/util/wallet.go index 2110adb1..e0e553d0 100644 --- a/cmd/frostfs-adm/internal/modules/morph/util/wallet.go +++ b/cmd/frostfs-adm/internal/modules/morph/util/wallet.go @@ -41,7 +41,7 @@ func InitializeContractWallet(v *viper.Viper, walletDir string) (*wallet.Wallet, return w, nil } -func OpenContractWallet(v *viper.Viper, cmd *cobra.Command, walletDir string) (*wallet.Wallet, error) { +func openContractWallet(v *viper.Viper, cmd *cobra.Command, walletDir string) (*wallet.Wallet, error) { p := filepath.Join(walletDir, ContractWalletFilename) w, err := wallet.NewWalletFromFile(p) if err != nil { @@ -67,9 +67,9 @@ func OpenContractWallet(v *viper.Viper, cmd *cobra.Command, walletDir string) (* return w, nil } -func GetWallet(cmd *cobra.Command, v *viper.Viper, needContracts bool, walletDir string) (*wallet.Wallet, error) { +func getWallet(cmd *cobra.Command, v *viper.Viper, needContracts bool, walletDir string) (*wallet.Wallet, error) { if !needContracts { return nil, nil } - return OpenContractWallet(v, cmd, walletDir) + return openContractWallet(v, cmd, walletDir) }