Compare strings using strings.EqualFold() (#8193)

This commit is contained in:
Victor Farazdagi
2021-01-04 08:46:22 -08:00
committed by GitHub
parent 4c6e0c5f46
commit 7c25d5c852
9 changed files with 15 additions and 15 deletions

View File

@@ -29,7 +29,7 @@ func restore(cliCtx *cli.Context) error {
if err != nil {
return errors.Wrap(err, "could not validate choice")
}
if strings.ToLower(resp) == "n" {
if strings.EqualFold(resp, "n") {
logrus.Info("Restore aborted")
return nil
}

View File

@@ -53,7 +53,7 @@ func VerifyTosAcceptedOrPrompt(ctx *cli.Context) error {
if err != nil {
return errors.New(acceptTosPromptErrText)
}
if strings.ToLower(input) != "accept" {
if !strings.EqualFold(input, "accept") {
return errors.New("you have to accept Terms and Conditions in order to continue")
}

View File

@@ -29,7 +29,7 @@ func restore(cliCtx *cli.Context) error {
if err != nil {
return errors.Wrap(err, "could not validate choice")
}
if strings.ToLower(resp) == "n" {
if strings.EqualFold(resp, "n") {
logrus.Info("Restore aborted")
return nil
}

View File

@@ -66,7 +66,7 @@ func DeleteAccountCli(cliCtx *cli.Context) error {
if err != nil {
return err
}
if strings.ToLower(resp) == "n" {
if strings.EqualFold(resp, "n") {
return nil
}
} else {
@@ -80,7 +80,7 @@ func DeleteAccountCli(cliCtx *cli.Context) error {
if err != nil {
return err
}
if strings.ToLower(resp) == "n" {
if strings.EqualFold(resp, "n") {
return nil
}
}

View File

@@ -62,7 +62,7 @@ func DisableAccountsCli(cliCtx *cli.Context) error {
if err != nil {
return err
}
if strings.ToLower(resp) == "n" {
if strings.EqualFold(resp, "n") {
return nil
}
} else {
@@ -76,7 +76,7 @@ func DisableAccountsCli(cliCtx *cli.Context) error {
if err != nil {
return err
}
if strings.ToLower(resp) == "n" {
if strings.EqualFold(resp, "n") {
return nil
}
}
@@ -145,7 +145,7 @@ func EnableAccountsCli(cliCtx *cli.Context) error {
if err != nil {
return err
}
if strings.ToLower(resp) == "n" {
if strings.EqualFold(resp, "n") {
return nil
}
} else {
@@ -159,7 +159,7 @@ func EnableAccountsCli(cliCtx *cli.Context) error {
if err != nil {
return err
}
if strings.ToLower(resp) == "n" {
if strings.EqualFold(resp, "n") {
return nil
}
}

View File

@@ -126,7 +126,7 @@ func interact(cliCtx *cli.Context, r io.Reader, validatingPublicKeys [][48]byte)
if err != nil {
return nil, nil, err
}
if strings.ToLower(resp) == "n" {
if strings.EqualFold(resp, "n") {
return nil, nil, nil
}
} else {
@@ -142,7 +142,7 @@ func interact(cliCtx *cli.Context, r io.Reader, validatingPublicKeys [][48]byte)
if err != nil {
return nil, nil, err
}
if strings.ToLower(resp) == "n" {
if strings.EqualFold(resp, "n") {
return nil, nil, nil
}
}
@@ -162,7 +162,7 @@ func interact(cliCtx *cli.Context, r io.Reader, validatingPublicKeys [][48]byte)
if err != nil {
return nil, nil, err
}
if strings.ToLower(resp) == "n" {
if strings.EqualFold(resp, "n") {
return nil, nil, nil
}

View File

@@ -147,7 +147,7 @@ func extractWalletCreationConfigFromCli(cliCtx *cli.Context, keymanagerKind keym
if err != nil {
return nil, errors.Wrap(err, "could not validate choice")
}
if strings.ToLower(resp) == "y" {
if strings.EqualFold(resp, "y") {
mnemonicPassphrase, err := promptutil.InputPassword(
cliCtx,
flags.Mnemonic25thWordFileFlag,

View File

@@ -58,7 +58,7 @@ func RecoverWalletCli(cliCtx *cli.Context) error {
if err != nil {
return errors.Wrap(err, "could not validate choice")
}
if strings.ToLower(resp) == "y" {
if strings.EqualFold(resp, "y") {
mnemonicPassphrase, err := promptutil.InputPassword(
cliCtx,
flags.Mnemonic25thWordFileFlag,

View File

@@ -28,7 +28,7 @@ func restore(cliCtx *cli.Context) error {
if err != nil {
return errors.Wrap(err, "could not validate choice")
}
if strings.ToLower(resp) == "n" {
if strings.EqualFold(resp, "n") {
logrus.Info("Restore aborted")
return nil
}