chore: fix all linting (#24101)
This commit is contained in:
+1
-1
@@ -375,7 +375,7 @@ func printCreate(cmd *cobra.Command, k *keyring.Record, showMnemonic bool, mnemo
|
||||
// print mnemonic unless requested not to.
|
||||
if showMnemonic {
|
||||
if _, err := fmt.Fprintf(cmd.ErrOrStderr(), "\n**Important** write this mnemonic phrase in a safe place.\nIt is the only way to recover your account if you ever forget your password.\n\n%s\n", mnemonic); err != nil {
|
||||
return fmt.Errorf("failed to print mnemonic: %v", err)
|
||||
return fmt.Errorf("failed to print mnemonic: %w", err)
|
||||
}
|
||||
}
|
||||
case flags.OutputFormatJSON:
|
||||
|
||||
@@ -163,7 +163,6 @@ func Test_runAddCmdLedgerDryRun(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, tt := range testData {
|
||||
tt := tt
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
cmd := AddKeyCommand()
|
||||
cmd.Flags().AddFlagSet(Commands().PersistentFlags())
|
||||
|
||||
@@ -202,7 +202,6 @@ func Test_runAddCmdDryRun(t *testing.T) {
|
||||
},
|
||||
}
|
||||
for _, tt := range testData {
|
||||
tt := tt
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
cmd := AddKeyCommand()
|
||||
cmd.Flags().AddFlagSet(Commands().PersistentFlags())
|
||||
|
||||
@@ -20,6 +20,8 @@ import (
|
||||
)
|
||||
|
||||
func cleanupKeys(t *testing.T, kb keyring.Keyring, keys ...string) func() {
|
||||
t.Helper()
|
||||
|
||||
return func() {
|
||||
for _, k := range keys {
|
||||
if err := kb.Delete(k); err != nil {
|
||||
@@ -59,7 +61,6 @@ func Test_runListCmd(t *testing.T) {
|
||||
{"keybase: w/key", kbHome2, false},
|
||||
}
|
||||
for _, tt := range testData {
|
||||
tt := tt
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
cmd.SetArgs([]string{
|
||||
fmt.Sprintf("--%s=%s", flags.FlagKeyringDir, tt.kbDir),
|
||||
|
||||
@@ -25,7 +25,6 @@ func TestParseKey(t *testing.T) {
|
||||
{"hex", []string{hexstr}, false},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
tt := tt
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
require.Equal(t, tt.wantErr, doParseKey(ParseKeyStringCommand(), config, tt.args) != nil)
|
||||
})
|
||||
|
||||
+2
-2
@@ -66,14 +66,14 @@ func runShowCmd(cmd *cobra.Command, args []string) (err error) {
|
||||
if len(args) == 1 {
|
||||
k, err = fetchKey(clientCtx.Keyring, args[0])
|
||||
if err != nil {
|
||||
return fmt.Errorf("%s is not a valid name or address: %v", args[0], err)
|
||||
return fmt.Errorf("%s is not a valid name or address: %w", args[0], err)
|
||||
}
|
||||
} else {
|
||||
pks := make([]cryptotypes.PubKey, len(args))
|
||||
for i, keyref := range args {
|
||||
k, err := fetchKey(clientCtx.Keyring, keyref)
|
||||
if err != nil {
|
||||
return fmt.Errorf("%s is not a valid name or address: %v", keyref, err)
|
||||
return fmt.Errorf("%s is not a valid name or address: %w", keyref, err)
|
||||
}
|
||||
key, err := k.GetPubKey()
|
||||
if err != nil {
|
||||
|
||||
@@ -215,7 +215,6 @@ func Test_validateMultisigThreshold(t *testing.T) {
|
||||
{"1-2", args{2, 1}, true},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
tt := tt
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
if err := validateMultisigThreshold(tt.args.k, tt.args.nKeys); (err != nil) != tt.wantErr {
|
||||
t.Errorf("validateMultisigThreshold() error = %v, wantErr %v", err, tt.wantErr)
|
||||
@@ -241,7 +240,6 @@ func Test_getBechKeyOut(t *testing.T) {
|
||||
{"cons", args{sdk.PrefixConsensus}, MkConsKeyOutput, false},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
tt := tt
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
got, err := getBechKeyOut(tt.args.bechPrefix)
|
||||
if tt.wantErr {
|
||||
|
||||
Reference in New Issue
Block a user