mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-18 18:02:24 +00:00
all: fix minor style issues, add linters
This commit is contained in:
parent
ce2c957fbb
commit
396f5a9345
6 changed files with 9 additions and 9 deletions
|
|
@ -27,6 +27,8 @@ linters:
|
|||
- durationcheck
|
||||
- gocheckcompilerdirectives
|
||||
- reassign
|
||||
- mirror
|
||||
- tenv
|
||||
### linters we tried and will not be using:
|
||||
###
|
||||
# - structcheck # lots of false positives
|
||||
|
|
|
|||
|
|
@ -252,7 +252,7 @@ func Bind(types []string, abis []string, bytecodes []string, fsigs []map[string]
|
|||
}
|
||||
// Parse library references.
|
||||
for pattern, name := range libs {
|
||||
matched, err := regexp.Match("__\\$"+pattern+"\\$__", []byte(contracts[types[i]].InputBin))
|
||||
matched, err := regexp.MatchString("__\\$"+pattern+"\\$__", contracts[types[i]].InputBin)
|
||||
if err != nil {
|
||||
log.Error("Could not search for pattern", "pattern", pattern, "contract", contracts[types[i]], "err", err)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -152,7 +152,7 @@ func remoteConsole(ctx *cli.Context) error {
|
|||
func ephemeralConsole(ctx *cli.Context) error {
|
||||
var b strings.Builder
|
||||
for _, file := range ctx.Args().Slice() {
|
||||
b.Write([]byte(fmt.Sprintf("loadScript('%s');", file)))
|
||||
b.WriteString(fmt.Sprintf("loadScript('%s');", file))
|
||||
}
|
||||
utils.Fatalf(`The "js" command is deprecated. Please use the following instead:
|
||||
geth --exec "%s" console`, b.String())
|
||||
|
|
|
|||
|
|
@ -121,7 +121,7 @@ func (v *BlockValidator) ValidateBody(block *types.Block) error {
|
|||
// such as amount of used gas, the receipt roots and the state root itself.
|
||||
func (v *BlockValidator) ValidateState(block *types.Block, statedb *state.StateDB, res *ProcessResult, stateless bool) error {
|
||||
if res == nil {
|
||||
return fmt.Errorf("nil ProcessResult value")
|
||||
return errors.New("nil ProcessResult value")
|
||||
}
|
||||
header := block.Header()
|
||||
if block.GasUsed() != res.GasUsed {
|
||||
|
|
@ -150,7 +150,7 @@ func (v *BlockValidator) ValidateState(block *types.Block, statedb *state.StateD
|
|||
return fmt.Errorf("invalid requests hash (remote: %x local: %x)", *header.RequestsHash, reqhash)
|
||||
}
|
||||
} else if res.Requests != nil {
|
||||
return fmt.Errorf("block has requests before prague fork")
|
||||
return errors.New("block has requests before prague fork")
|
||||
}
|
||||
// Validate the state root against the received state root and throw
|
||||
// an error if they don't match.
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ func (e ErrStackUnderflow) Error() string {
|
|||
}
|
||||
|
||||
func (e ErrStackUnderflow) Unwrap() error {
|
||||
return fmt.Errorf("stack underflow")
|
||||
return errors.New("stack underflow")
|
||||
}
|
||||
|
||||
// ErrStackOverflow wraps an evm error when the items on the stack exceeds
|
||||
|
|
@ -71,7 +71,7 @@ func (e ErrStackOverflow) Error() string {
|
|||
}
|
||||
|
||||
func (e ErrStackOverflow) Unwrap() error {
|
||||
return fmt.Errorf("stack overflow")
|
||||
return errors.New("stack overflow")
|
||||
}
|
||||
|
||||
// ErrInvalidOpCode wraps an evm error when an invalid opcode is encountered.
|
||||
|
|
|
|||
|
|
@ -17,14 +17,12 @@
|
|||
package flags
|
||||
|
||||
import (
|
||||
"os"
|
||||
"os/user"
|
||||
"runtime"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestPathExpansion(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
user, _ := user.Current()
|
||||
var tests map[string]string
|
||||
|
|
@ -53,7 +51,7 @@ func TestPathExpansion(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
os.Setenv(`DDDXXX`, `/tmp`)
|
||||
t.Setenv(`DDDXXX`, `/tmp`)
|
||||
for test, expected := range tests {
|
||||
t.Run(test, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
|
|
|||
Loading…
Reference in a new issue