diff --git a/cmd/basecoin/commands/init.go b/cmd/basecoin/commands/init.go index 58688a1504..ac4520539a 100644 --- a/cmd/basecoin/commands/init.go +++ b/cmd/basecoin/commands/init.go @@ -7,6 +7,7 @@ import ( "path" "github.com/spf13/cobra" + "github.com/spf13/viper" tcmd "github.com/tendermint/tendermint/cmd/tendermint/commands" ) @@ -18,16 +19,13 @@ var InitCmd = &cobra.Command{ RunE: initCmd, } -//flags +//nolint - flags var ( - flagChainID string + FlagChainID = "chain-id" //TODO group with other flags or remove? is this already a flag here? ) func init() { - flags := []Flag2Register{ - {&flagChainID, "chain-id", "test_chain_id", "Chain ID"}, - } - RegisterFlags(InitCmd, flags) + InitCmd.Flags().String(FlagChainID, "test_chain_id", "Chain ID") } // returns 1 iff it set a file, otherwise 0 (so we can add them) @@ -60,7 +58,7 @@ func initCmd(cmd *cobra.Command, args []string) error { privValFile := cfg.PrivValidatorFile() keyFile := path.Join(cfg.RootDir, "key.json") - mod1, err := setupFile(genesisFile, GetGenesisJSON(flagChainID, userAddr), 0644) + mod1, err := setupFile(genesisFile, GetGenesisJSON(viper.GetString(FlagChainID), userAddr), 0644) if err != nil { return err } diff --git a/docs/guide/counter/plugins/counter/counter_test.go b/docs/guide/counter/plugins/counter/counter_test.go index c29f9f4bdd..fcc36a15c1 100644 --- a/docs/guide/counter/plugins/counter/counter_test.go +++ b/docs/guide/counter/plugins/counter/counter_test.go @@ -39,7 +39,7 @@ func TestCounterPlugin(t *testing.T) { // Seed Basecoin with account test1Acc := test1PrivAcc.Account - test1Acc.Balance = types.Coins{{"", 1000}, {"gold", 1000}} //nolint + test1Acc.Balance = types.Coins{{"", 1000}, {"gold", 1000}} accOpt, err := json.Marshal(test1Acc) require.Nil(t, err) log := bcApp.SetOption("coin/account", string(accOpt)) @@ -64,10 +64,10 @@ func TestCounterPlugin(t *testing.T) { assert.True(res.IsErr(), res.String()) // Test the fee (increments sequence) - res = DeliverCounterTx(true, types.Coins{{"gold", 100}}, 1) //nolint + res = DeliverCounterTx(true, types.Coins{{"gold", 100}}, 1) assert.True(res.IsOK(), res.String()) // Test unsupported fee - res = DeliverCounterTx(true, types.Coins{{"silver", 100}}, 2) //nolint + res = DeliverCounterTx(true, types.Coins{{"silver", 100}}, 2) assert.True(res.IsErr(), res.String()) }