Skip to content

Commit

Permalink
another batch of lint warning fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jbsv committed Feb 8, 2025
1 parent 659a9b6 commit 5614af8
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 19 deletions.
2 changes: 1 addition & 1 deletion cli/node/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ func (b *CLIBuilder) MakeAction(tmpl ActionTemplate) cli.Action {
// Prepare a set of flags that will be transmitted to the daemon so that
// the action has access to the same flags and their values.
fset := make(FlagSet)
lookupFlags(fset, c.(*urfave.Context))
lookupFlags(fset, c.(*urfave.Context)) //nolint:errcheck

buf, err := json.Marshal(fset)
if err != nil {
Expand Down
6 changes: 3 additions & 3 deletions contracts/access/access_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ func TestGrant(t *testing.T) {
require.EqualError(t, err, fake.Err("failed to grant"))
}

func TestRegisterContract(t *testing.T) {
func TestRegisterContract(_ *testing.T) {
RegisterContract(native.NewExecution(), Contract{})
}

Expand Down Expand Up @@ -135,10 +135,10 @@ type fakeStore struct {
store.Snapshot
}

func (s fakeStore) Get(key []byte) ([]byte, error) {
func (s fakeStore) Get(_ []byte) ([]byte, error) {
return nil, nil
}

func (s fakeStore) Set(key, value []byte) error {
func (s fakeStore) Set(_, _ []byte) error {
return nil
}
3 changes: 2 additions & 1 deletion core/ordering/cosipbft/blockstore/genesis_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ import (
)

func TestCachedGenesis_Get(t *testing.T) {
store := NewGenesisStore().(*cachedGenesis)
store := NewGenesisStore().(*cachedGenesis) //nolint:errcheck
require.NotNil(t, store)

ro := authority.FromAuthority(fake.NewAuthority(3, fake.NewSigner))

Expand Down
2 changes: 1 addition & 1 deletion core/ordering/cosipbft/cosipbft.go
Original file line number Diff line number Diff line change
Expand Up @@ -838,7 +838,7 @@ type observer struct {
}

func (obs observer) NotifyCallback(event interface{}) {
obs.ch <- event.(ordering.Event)
obs.ch <- event.(ordering.Event) //nolint:errcheck
}

func calculateBackoff(backoff float64) time.Duration {
Expand Down
10 changes: 5 additions & 5 deletions core/ordering/cosipbft/proc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -258,15 +258,15 @@ type fakeSnapshot struct {
err error
}

func (snap fakeSnapshot) Get(key []byte) ([]byte, error) {
func (snap fakeSnapshot) Get(_ []byte) ([]byte, error) {
return []byte{}, snap.err
}

func (snap fakeSnapshot) Set(key []byte, value []byte) error {
func (snap fakeSnapshot) Set(_ []byte, value []byte) error {
return snap.err
}

func (snap fakeSnapshot) Delete(key []byte) error {
func (snap fakeSnapshot) Delete(_ []byte) error {
return snap.err
}

Expand All @@ -283,11 +283,11 @@ func (t fakeTree) GetRoot() []byte {
return []byte("root")
}

func (t fakeTree) GetPath(key []byte) (hashtree.Path, error) {
func (t fakeTree) GetPath(_ []byte) (hashtree.Path, error) {
return nil, t.err
}

func (t fakeTree) Get(key []byte) ([]byte, error) {
func (t fakeTree) Get(_ []byte) ([]byte, error) {
return []byte("[]"), t.err
}

Expand Down
2 changes: 1 addition & 1 deletion core/store/kv/controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func NewController() node.Initializer {
}

// SetCommands implements node.Initializer. It does not register any command.
func (m minimalController) SetCommands(builder node.Builder) {}
func (m minimalController) SetCommands(_ node.Builder) {}

// OnStart implements node.Initializer. It opens the database in a file using
// the config path as the base.
Expand Down
10 changes: 6 additions & 4 deletions core/store/kv/default_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ func TestBoltDB_Close(t *testing.T) {

err = db.Close()
require.NoError(t, err)
require.Error(t, db.(boltDB).bolt.Sync())
err = db.(boltDB).bolt.Sync()

Check failure on line 64 in core/store/kv/default_test.go

View workflow job for this annotation

GitHub Actions / lint

Error return value is not checked (errcheck)
require.Error(t, err)
}

func TestBoltTx_GetBucket(t *testing.T) {
Expand Down Expand Up @@ -165,20 +166,21 @@ func TestBoltBucket_Scan(t *testing.T) {
require.NoError(t, b.Set([]byte{0}, []byte{0}))

var i byte = 0
b.Scan(nil, func(k, v []byte) error {
err = b.Scan(nil, func(k, v []byte) error {
require.Equal(t, []byte{i}, k)
require.Equal(t, []byte{i}, v)
i += 7
return nil
})
require.NoError(t, err)
require.Equal(t, byte(14), i)

err = b.Scan([]byte{1}, func(k, v []byte) error {
err = b.Scan([]byte{1}, func(_, _ []byte) error {
return xerrors.New("callback error")
})
require.NoError(t, err)

err = b.Scan([]byte{}, func(k, v []byte) error {
err = b.Scan([]byte{}, func(_, _ []byte) error {
return xerrors.New("callback error")
})
require.EqualError(t, err, "callback error")
Expand Down
2 changes: 1 addition & 1 deletion core/txn/signed/controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func (mgrController) SetCommands(node.Builder) {}

// OnStart implements node.Initializer. It creates a transaction manager using
// the signer of the collective signing component and injects it.
func (mgrController) OnStart(flags cli.Flags, inj node.Injector) error {
func (mgrController) OnStart(_ cli.Flags, inj node.Injector) error {
var srvc ordering.Service
err := inj.Resolve(&srvc)
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions internal/traffic/mod_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ func TestSaveEvents(t *testing.T) {

defer os.RemoveAll(path)

if runtime.GOOS == "windows" {
if runtime.GOOS == Windows {
return
}

Expand All @@ -106,7 +106,7 @@ func TestTraffic_Save(t *testing.T) {

defer os.RemoveAll(path)

if runtime.GOOS == "windows" {
if runtime.GOOS == Windows {
return
}

Expand Down

0 comments on commit 5614af8

Please sign in to comment.