This commit is contained in:
Jim McDonald
2023-06-05 20:41:04 +01:00
parent 2880ec9bdd
commit 7d723148ab
6 changed files with 6 additions and 5 deletions

View File

@@ -128,6 +128,7 @@ linters:
- contextcheck
- cyclop
- deadcode
- depguard
- dupl
- errorlint
- exhaustive

View File

@@ -86,7 +86,7 @@ func processPathed(ctx context.Context, data *dataIn) (*dataOut, error) {
if data.passphrase == "" {
return nil, errors.New("passphrase is required")
}
match, err := regexp.Match("^m/[0-9]+/[0-9]+(/[0-9+])+", []byte(data.path))
match, err := regexp.MatchString("^m/[0-9]+/[0-9]+(/[0-9+])+", data.path)
if err != nil {
return nil, errors.Wrap(err, "unable to match path to regular expression")
}

View File

@@ -163,7 +163,7 @@ func (c *command) generateOperationFromMnemonicAndPath(ctx context.Context) erro
}
validatorKeyPath := c.path
match := validatorPath.Match([]byte(c.path))
match := validatorPath.MatchString(c.path)
if !match {
return fmt.Errorf("path %s does not match EIP-2334 format for a validator", c.path)
}

View File

@@ -144,7 +144,7 @@ func (c *command) generateOperationFromMnemonicAndPath(ctx context.Context) erro
}
validatorKeyPath := c.path
match := validatorPath.Match([]byte(c.path))
match := validatorPath.MatchString(c.path)
if !match {
return fmt.Errorf("path %s does not match EIP-2334 format for a validator", c.path)
}

View File

@@ -252,7 +252,7 @@ func accountFromMnemonicAndPath(mnemonic string, path string) (e2wtypes.Account,
}
// Ensure the path is valid.
match := hdPathRegex.Match([]byte(path))
match := hdPathRegex.MatchString(path)
if !match {
return nil, errors.New("path does not match expected format m/…")
}

View File

@@ -196,7 +196,7 @@ func WalletAndAccountsFromPath(ctx context.Context, path string) (e2wtypes.Walle
accounts := make([]e2wtypes.Account, 0)
for account := range wallet.Accounts(ctx) {
if re.Match([]byte(account.Name())) {
if re.MatchString(account.Name()) {
accounts = append(accounts, account)
}
}