Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix linter errors #1379

Open
wants to merge 93 commits into
base: master
Choose a base branch
from
Open

Fix linter errors #1379

wants to merge 93 commits into from

Conversation

suhasagg
Copy link
Contributor

  • I added unit tests for any code that added
  • I updated the CHANGELOG.md
  • All IP is original and not copied from another source
  • I assign all copyright to Loom Network for the code in the pull request

@mukuls9971 mukuls9971 self-assigned this Jul 30, 2019
@@ -72,6 +72,7 @@ func TestSignatureTxMiddlewareMultipleTxSameBlock(t *testing.T) {
//State is reset on every run
ctx2 := context.WithValue(context.Background(), ContextKeyOrigin, origin)
state2 := loomchain.NewStoreState(ctx2, store.NewMemStore(), abci.Header{Height: 27}, nil, nil)
//nolint: ineffassign
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't ignore these warnings, fix them.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually assignment was assigning some variables which might be useful later on in tests but were not currently being used. I have fixed it as they can be assigned if needed.

@@ -80,6 +81,7 @@ func testLogPoll(t *testing.T, version handler.ReceiptHandlerVersion) {
require.Equal(t, 0, len(logs.EthBlockLogs), "wrong number of logs returned")
state60 := common.MockStateAt(state, uint64(60))
sub.Remove(id)
//nolint: ineffassign
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These too should be fixed, not ignored.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually assignment was assigning some variables which might be useful later on in tests but were not currently being used. I have fixed it as they can be assigned if needed.

evm/loomethdb.go Outdated
params LogParams
batch batch
params LogParams
//nolint: unused, varcheck, deadcode, structcheck
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should probably fix all those

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

karma/karma.go Outdated Show resolved Hide resolved
privval/hsm/yubi.go Show resolved Hide resolved
@@ -146,6 +146,7 @@ func (m *MultiWriterAppStoreTestSuite) TestMultiWriterAppStoreSnapShotFlushInter
require.Equal([]byte("test2"), snapshotv1.Get([]byte("test2")))

// this flushes all data to disk
//nolint: ineffassign
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix this

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

addr3 = loom.MustParseAddress("default:0x5cecd1f7261e1f4c684e297be3edf03b825e01c5")
addr4 = loom.MustParseAddress("default:0x5cecd1f7261e1f4c684e297be3edf03b825e01c7")
addr5 = loom.MustParseAddress("default:0x5cecd1f7261e1f4c684e297be3edf03b825e01c9")
//nolint: unused, varcheck, deadcode
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If these are really unused then remove them.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@suhasagg suhasagg self-assigned this Jul 30, 2019
Solves ==>
should use raw string (`...`) with regexp.MustCompile to avoid having to escape twice (gosimple)
Solves ==>
should use raw string (`...`) with regexp.MustCompile to avoid having to escape twice (gosimple)
Solves ==>
should use raw string (`...`) with regexp.MustCompile to avoid having to escape twice (gosimple)
@suhasagg
Copy link
Contributor Author

suhasagg commented Jul 30, 2019

govet linter reporting a copied mutex
-----------------------------------------------------

evm/loomethdb.go:126:29: Dump passes lock by value: log.Logger contains sync.Mutex (govet)
func (b *batch) Dump(logger log.Logger) {
                            ^
evm/loomethdb.go:225:16: call of b.batch.Dump copies lock value: log.Logger contains sync.Mutex (govet)
		b.batch.Dump(logger)
		             ^
evm/loomethdb.go:244:16: call of b.batch.Dump copies lock value: log.Logger contains sync.Mutex (govet)
		b.batch.Dump(logger)
		             ^
evm/loomethdb.go:249:16: call of b.batch.Dump copies lock value: log.Logger contains sync.Mutex (govet)
		b.batch.Dump(logger)

@suhasagg
Copy link
Contributor Author

Some discussion in this context -
golang/go#13675

@traceCall traceCall requested a review from enlight August 8, 2019 06:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants