mirror of
https://github.com/wealdtech/ethdo.git
synced 2026-01-09 14:07:56 -05:00
linting.
This commit is contained in:
@@ -128,6 +128,7 @@ linters:
|
|||||||
- contextcheck
|
- contextcheck
|
||||||
- cyclop
|
- cyclop
|
||||||
- deadcode
|
- deadcode
|
||||||
|
- depguard
|
||||||
- dupl
|
- dupl
|
||||||
- errorlint
|
- errorlint
|
||||||
- exhaustive
|
- exhaustive
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ func processPathed(ctx context.Context, data *dataIn) (*dataOut, error) {
|
|||||||
if data.passphrase == "" {
|
if data.passphrase == "" {
|
||||||
return nil, errors.New("passphrase is required")
|
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 {
|
if err != nil {
|
||||||
return nil, errors.Wrap(err, "unable to match path to regular expression")
|
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
|
validatorKeyPath := c.path
|
||||||
match := validatorPath.Match([]byte(c.path))
|
match := validatorPath.MatchString(c.path)
|
||||||
if !match {
|
if !match {
|
||||||
return fmt.Errorf("path %s does not match EIP-2334 format for a validator", c.path)
|
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
|
validatorKeyPath := c.path
|
||||||
match := validatorPath.Match([]byte(c.path))
|
match := validatorPath.MatchString(c.path)
|
||||||
if !match {
|
if !match {
|
||||||
return fmt.Errorf("path %s does not match EIP-2334 format for a validator", c.path)
|
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.
|
// Ensure the path is valid.
|
||||||
match := hdPathRegex.Match([]byte(path))
|
match := hdPathRegex.MatchString(path)
|
||||||
if !match {
|
if !match {
|
||||||
return nil, errors.New("path does not match expected format m/…")
|
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)
|
accounts := make([]e2wtypes.Account, 0)
|
||||||
for account := range wallet.Accounts(ctx) {
|
for account := range wallet.Accounts(ctx) {
|
||||||
if re.Match([]byte(account.Name())) {
|
if re.MatchString(account.Name()) {
|
||||||
accounts = append(accounts, account)
|
accounts = append(accounts, account)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user