[#1442] cli/tree: Enchance error message if rpc-endpoint isn't defined
All checks were successful
DCO action / DCO (pull_request) Successful in 1m6s
Tests and linters / Run gofumpt (pull_request) Successful in 1m57s
Build / Build Components (pull_request) Successful in 2m11s
Vulncheck / Vulncheck (pull_request) Successful in 2m4s
Pre-commit hooks / Pre-commit (pull_request) Successful in 2m14s
Tests and linters / Staticcheck (pull_request) Successful in 2m45s
Tests and linters / Lint (pull_request) Successful in 3m27s
Tests and linters / gopls check (pull_request) Successful in 3m35s
Tests and linters / Tests (pull_request) Successful in 3m42s
Tests and linters / Tests with -race (pull_request) Successful in 4m35s

Signed-off-by: Aleksey Savchuk <a.savchuk@yadro.com>
This commit is contained in:
Aleksey Savchuk 2024-10-23 15:37:50 +03:00
parent b9284604d9
commit 29708b78d7

View file

@ -2,6 +2,7 @@ package tree
import ( import (
"context" "context"
"fmt"
"strings" "strings"
"git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-cli/internal/common" "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-cli/internal/common"
@ -20,7 +21,13 @@ import (
// after making Tree API public. // after making Tree API public.
func _client() (tree.TreeServiceClient, error) { func _client() (tree.TreeServiceClient, error) {
var netAddr network.Address var netAddr network.Address
err := netAddr.FromString(viper.GetString(commonflags.RPC))
rpcEndpoint := viper.GetString(commonflags.RPC)
if rpcEndpoint == "" {
return nil, fmt.Errorf("%s is not defined", commonflags.RPC)
}
err := netAddr.FromString(rpcEndpoint)
if err != nil { if err != nil {
return nil, err return nil, err
} }