mirror of
https://github.com/arnaucube/hermez-node.git
synced 2026-02-07 11:26:44 +01:00
Add lint checks: gofmt, goimports, golint
- gofmt - Gofmt checks whether code was gofmt-ed. By default this tool runs
with -s option to check for code simplification
- goimports - Goimports does everything that gofmt does. Additionally it checks
unused imports
- golint - Golint differs from gofmt. Gofmt reformats Go source code, whereas
golint prints out style mistakes
- checks the uncommented exported functions & types
Update the code to fix the lint checks.
This commit is contained in:
@@ -13,10 +13,12 @@ import (
|
||||
"github.com/iden3/go-merkletree/db/pebble"
|
||||
)
|
||||
|
||||
// ErrStateDBWithoutMT is used when a method that requires a MerkleTree is called in a StateDB that does not have a MerkleTree defined
|
||||
// ErrStateDBWithoutMT is used when a method that requires a MerkleTree is
|
||||
// called in a StateDB that does not have a MerkleTree defined
|
||||
var ErrStateDBWithoutMT = errors.New("Can not call method to use MerkleTree in a StateDB without MerkleTree")
|
||||
|
||||
// ErrAccountAlreadyExists is used when CreateAccount is called and the Account already exists
|
||||
// ErrAccountAlreadyExists is used when CreateAccount is called and the Account
|
||||
// already exists
|
||||
var ErrAccountAlreadyExists = errors.New("Can not CreateAccount because Account already exists")
|
||||
|
||||
// KEYCURRENTBATCH is used as key in the db to store the current BatchNum
|
||||
@@ -24,7 +26,13 @@ var KEYCURRENTBATCH = []byte("currentbatch")
|
||||
|
||||
// PATHSTATEDB defines the subpath of the StateDB
|
||||
const PATHSTATEDB = "/statedb"
|
||||
|
||||
// PATHBATCHNUM defines the subpath of the Batch Checkpoint in the subpath of
|
||||
// the StateDB
|
||||
const PATHBATCHNUM = "/BatchNum"
|
||||
|
||||
// PATHCURRENT defines the subpath of the current Batch in the subpath of the
|
||||
// StateDB
|
||||
const PATHCURRENT = "/current"
|
||||
|
||||
// StateDB represents the StateDB object
|
||||
@@ -159,7 +167,7 @@ func (s *StateDB) Reset(batchNum common.BatchNum) error {
|
||||
return err
|
||||
}
|
||||
// copy 'BatchNumX' to 'current'
|
||||
cmd := exec.Command("cp", "-r", checkpointPath, currentPath)
|
||||
cmd := exec.Command("cp", "-r", checkpointPath, currentPath) //nolint:gosec
|
||||
err = cmd.Run()
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -354,13 +362,13 @@ func (l *LocalStateDB) Reset(batchNum common.BatchNum, fromSynchronizer bool) er
|
||||
return err
|
||||
}
|
||||
// copy synchronizer'BatchNumX' to 'current'
|
||||
cmd := exec.Command("cp", "-r", synchronizerCheckpointPath, currentPath)
|
||||
cmd := exec.Command("cp", "-r", synchronizerCheckpointPath, currentPath) //nolint:gosec
|
||||
err = cmd.Run()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
// copy synchronizer-'BatchNumX' to 'BatchNumX'
|
||||
cmd = exec.Command("cp", "-r", synchronizerCheckpointPath, checkpointPath)
|
||||
cmd = exec.Command("cp", "-r", synchronizerCheckpointPath, checkpointPath) //nolint:gosec
|
||||
err = cmd.Run()
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
Reference in New Issue
Block a user