[#932] adm: Reduce methods visibility in `util` package

Signed-off-by: Anton Nikiforov <an.nikiforov@yadro.com>
bugfix/namespace_require
Anton Nikiforov 2024-02-01 16:00:45 +03:00
parent f6ff3de0ae
commit a92188e5f9
3 changed files with 8 additions and 8 deletions

View File

@ -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
}

View File

@ -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)

View File

@ -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)
}