Skip to content

Commit

Permalink
cmd: removed aeCli as a global variable, so each subcommand has to in…
Browse files Browse the repository at this point in the history
…stantiate its own aeCli now. This helps go-vet detect problems where I would otherwise only get nil reference panics because aeCli wasn't initialized yet
  • Loading branch information
randomshinichi committed Feb 15, 2019
1 parent 5d16e89 commit 321b199
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions cmd/account.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ var balanceCmd = &cobra.Command{
Long: ``,
Args: cobra.ExactArgs(1),
Run: func(cmd *cobra.Command, args []string) {
aeCli := NewAeCli()
// ask for th keystore password
p, err := utils.AskPassword("Enter the password to unlock the keystore: ")
if err != nil {
Expand Down
1 change: 1 addition & 0 deletions cmd/inspect.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ func printResult(title string, v interface{}, err error) {
}

func inspect(cmd *cobra.Command, args []string) {
aeCli := NewAeCli()
for _, object := range args {
// height
if matched, _ := regexp.MatchString(`^\d+$`, object); matched {
Expand Down
1 change: 0 additions & 1 deletion cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ var RootCmd = &cobra.Command{

var nodeExternalAPI string
var debug, outputFormatJSON bool
var aeCli *aeternity.Ae

// Execute adds all child commands to the root command sets flags appropriately.
// This is called by main.main(). It only needs to happen once to the rootCmd.
Expand Down

0 comments on commit 321b199

Please sign in to comment.