mirror of
https://github.com/wealdtech/ethdo.git
synced 2026-01-07 21:24:01 -05:00
linting.
This commit is contained in:
@@ -128,6 +128,7 @@ linters:
|
||||
- contextcheck
|
||||
- cyclop
|
||||
- deadcode
|
||||
- depguard
|
||||
- dupl
|
||||
- errorlint
|
||||
- exhaustive
|
||||
|
||||
@@ -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")
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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/…")
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user