Skip to content

Instantly share code, notes, and snippets.

@zjshen14
Created January 4, 2019 19:44
Show Gist options
  • Save zjshen14/eed2fd1d59aca13b07052b60604aa16c to your computer and use it in GitHub Desktop.
Save zjshen14/eed2fd1d59aca13b07052b60604aa16c to your computer and use it in GitHub Desktop.
Zhijies-MacBook-Pro:iotex-core zjshen$ make lint-rich
Running golangcli lint...
action/action.go:194:2: ifElseChain: rewrite if-else to switch statement (gocritic)
	if pbAct.GetTransfer() != nil {
	^
action/putblock.go:99:11: unslice: could simplify nv[:] to nv (gocritic)
			Value: nv[:],
			       ^
address/address_v1.go:93:37: unslice: could simplify grouped[:] to grouped (gocritic)
	payload, err := bech32.ConvertBits(grouped[:], 5, 8, false)
	                                   ^
address/bech32/bech32.go:160:3: assignOp: replace `b = b << (8 - fromBits)` with `b <<= (8 - fromBits)` (gocritic)
		b = b << (8 - fromBits)
		^
address/bech32/bech32.go:181:4: assignOp: replace `b = b << toExtract` with `b <<= toExtract` (gocritic)
			b = b << toExtract
			^
address/bech32/bech32.go:197:3: assignOp: replace `nextByte = nextByte << (toBits - filledBits)` with `nextByte <<= (toBits - filledBits)` (gocritic)
		nextByte = nextByte << (toBits - filledBits)
		^
blockchain/blockdao.go:863:4: assignOp: replace `senderDelta[Sender] = senderDelta[Sender] + 1` with `senderDelta[Sender] += 1` (gocritic)
			senderDelta[Sender] = senderDelta[Sender] + 1
			^
blockchain/blockdao.go:887:4: assignOp: replace `recipientDelta[Recipient] = recipientDelta[Recipient] + 1` with `recipientDelta[Recipient] += 1` (gocritic)
			recipientDelta[Recipient] = recipientDelta[Recipient] + 1
			^
blockchain/blockdao.go:1302:4: assignOp: replace `senderDelta[Sender] = senderDelta[Sender] + 1` with `senderDelta[Sender] += 1` (gocritic)
			senderDelta[Sender] = senderDelta[Sender] + 1
			^
blockchain/blockdao.go:1315:4: assignOp: replace `recipientDelta[Recipient] = recipientDelta[Recipient] + 1` with `recipientDelta[Recipient] += 1` (gocritic)
			recipientDelta[Recipient] = recipientDelta[Recipient] + 1
			^
blockchain/block/block.go:176:26: unslice: could simplify b.Header.blockSig[:] to b.Header.blockSig (gocritic)
	stream = append(stream, b.Header.blockSig[:]...)
	                        ^
blockchain/block/block.go:177:26: unslice: could simplify b.Header.dkgID[:] to b.Header.dkgID (gocritic)
	stream = append(stream, b.Header.dkgID[:]...)
	                        ^
blockchain/block/block.go:178:26: unslice: could simplify b.Header.dkgPubkey[:] to b.Header.dkgPubkey (gocritic)
	stream = append(stream, b.Header.dkgPubkey[:]...)
	                        ^
blockchain/block/block.go:179:26: unslice: could simplify b.Header.dkgBlockSig[:] to b.Header.dkgBlockSig (gocritic)
	stream = append(stream, b.Header.dkgBlockSig[:]...)
	                        ^
blockchain/block/block.go:199:23: unslice: could simplify b.Header.blockSig[:] to b.Header.blockSig (gocritic)
	pbHeader.Signature = b.Header.blockSig[:]
	                     ^
blockchain/block/block.go:201:19: unslice: could simplify b.Header.dkgID[:] to b.Header.dkgID (gocritic)
	pbHeader.DkgID = b.Header.dkgID[:]
	                 ^
blockchain/block/block.go:202:23: unslice: could simplify b.Header.dkgPubkey[:] to b.Header.dkgPubkey (gocritic)
	pbHeader.DkgPubkey = b.Header.dkgPubkey[:]
	                     ^
blockchain/block/block.go:203:26: unslice: could simplify b.Header.dkgBlockSig[:] to b.Header.dkgBlockSig (gocritic)
	pbHeader.DkgSignature = b.Header.dkgBlockSig[:]
	                        ^
blockchain/block/block_test.go:137:8: appendAssign: append result not assigned to the same slice (gocritic)
	cat = append(hash2, hash3...)
	      ^
blockchain/block/block_test.go:141:8: appendAssign: append result not assigned to the same slice (gocritic)
	cat = append(hash4, hash4...)
	      ^
consensus/scheme/rolldpos/fsm.go:402:52: unslice: could simplify h[:] to h (gocritic)
	logger.Info().Str("blockHash", hex.EncodeToString(h[:])).Msg("Broadcast init proposal.")
	                                                  ^
consensus/scheme/rolldpos/fsm.go:487:21: unslice: could simplify hash[:] to hash (gocritic)
	return bytes.Equal(hash[:], blkHash[:])
	                   ^
consensus/scheme/rolldpos/fsm.go:504:24: unslice: could simplify vote.BlkHash[:] to vote.BlkHash (gocritic)
	if !m.isProposedBlock(vote.BlkHash[:]) {
	                      ^
consensus/scheme/rolldpos/rolldpos.go:165:34: unslice: could simplify blkHash[:] to blkHash (gocritic)
		Str("hash", hex.EncodeToString(blkHash[:]))
		                               ^
crypto/cryptosort.go:28:13: unslice: could simplify hashes[:] to hashes (gocritic)
	sort.Slice(hashes[:], func(i, j int) bool {
	           ^
crypto/cryptosort.go:40:13: unslice: could simplify candidates[:] to candidates (gocritic)
	sort.Slice(candidates[:], func(i, j int) bool {
	           ^
crypto/bls.go:73:22: unslice: could simplify msg[:] to msg (gocritic)
	msgString := string(msg[:])
	                    ^
crypto/bls.go:90:22: unslice: could simplify msg[:] to msg (gocritic)
	msgString := string(msg[:])
	                    ^
crypto/bls.go:164:22: unslice: could simplify msg[:] to msg (gocritic)
	msgString := string(msg[:])
	                    ^
crypto/bls.go:230:26: unslice: could simplify point[:] to point (gocritic)
	rbuf := bytes.NewReader(point[:])
	                        ^
crypto/bls.go:263:26: unslice: could simplify point[:] to point (gocritic)
	rbuf := bytes.NewReader(point[:])
	                        ^
crypto/ec160.go:111:26: unslice: could simplify pubKey[:] to pubKey (gocritic)
	rbuf := bytes.NewReader(pubKey[:])
	                        ^
crypto/ec160.go:139:26: unslice: could simplify privKey[:] to privKey (gocritic)
	rbuf := bytes.NewReader(privKey[:])
	                        ^
db/db.go:128:3: ifElseChain: rewrite if-else to switch statement (gocritic)
		if write.writeType == Put {
		^
db/db_badger.go:175:5: ifElseChain: rewrite if-else to switch statement (gocritic)
				if write.writeType == Put {
				^
db/trie/extensionnode.go:148:12: unslice: could simplify e.childHash[:] to e.childHash (gocritic)
				Value: e.childHash[:],
				       ^
endorsement/endorsement.go:57:26: unslice: could simplify en.BlkHash[:] to en.BlkHash (gocritic)
	stream = append(stream, en.BlkHash[:]...)
	                        ^
endorsement/endorsement.go:126:19: unslice: could simplify vote.BlkHash[:] to vote.BlkHash (gocritic)
		BlockHash:      vote.BlkHash[:],
		                ^
endorsement/endorsementset.go:127:17: unslice: could simplify s.blkHash[:] to s.blkHash (gocritic)
		BlockHash:    s.blkHash[:],
		              ^
explorer/explorer.go:122:23: underef: could simplify (*state).Nonce to state.Nonce (gocritic)
		Nonce:        int64((*state).Nonce),
		                    ^
explorer/explorer.go:124:17: underef: could simplify (*state).IsCandidate to state.IsCandidate (gocritic)
		IsCandidate:  (*state).IsCandidate,
		              ^
indexservice/server.go:58:29: unslice: could simplify blockAddr.Bytes()[:] to blockAddr.Bytes() (gocritic)
		addr = hex.EncodeToString(blockAddr.Bytes()[:])
		                          ^
iotxaddress/iotxaddress.go:118:37: unslice: could simplify grouped[:] to grouped (gocritic)
	payload, err := bech32.ConvertBits(grouped[:], 5, 8, false)
	                                   ^
state/factory/workingset.go:128:60: unslice: could simplify rootHash[:] to rootHash (gocritic)
	ws.cb.Put(AccountKVNameSpace, []byte(AccountTrieRootKey), rootHash[:], "failed to store accountTrie's root hash")
	                                                          ^
state/factory/workingset.go:136:3: unslice: could simplify rootHash[:] to rootHash (gocritic)
		rootHash[:],
		^
state/factory/factory_test.go:37:10: underef: could simplify (*cs[i]).Address to cs[i].Address (gocritic)
		r[i] = (*cs[i]).Address + ":" + strconv.FormatInt((*cs[i]).Votes.Int64(), 10)
		       ^
action/actctx.go:55:35: `refered` is a misspelling of `referred` (misspell)
// Hash returns the hash value of refered SealedActionEnvelope hash.
                                  ^
consensus/scheme/rolldpos/fsm_test.go:78:11: Using the variable on range scope `state` in function literal (scopelint)
			return state == cfsm.currentState(), nil
			       ^
p2p/agent_test.go:69:24: Using the variable on range scope `i` in function literal (scopelint)
			return counts[uint8(i)] == n, nil
			                    ^
p2p/agent_test.go:124:24: Using the variable on range scope `i` in function literal (scopelint)
			return counts[uint8(i)] == n-1, nil
			                    ^
blockchain/genesis.go:96:47: `ws` can be `github.com/iotexproject/iotex-core/action/protocol.StateManager` (interfacer)
func NewGenesisActions(chainCfg config.Chain, ws factory.WorkingSet) []action.SealedEnvelope {
                                              ^
p2p/agent.go:215:46: `addr` can be `expvar.Var` (interfacer)
func (p *Agent) Unicast(ctx context.Context, addr net.Addr, msg proto.Message) (err error) {
                                             ^
explorer/explorer.go:202:2: Consider preallocating `res` (prealloc)
	var res []explorer.Transfer
	^
explorer/explorer.go:282:2: Consider preallocating `res` (prealloc)
	var res []explorer.Transfer
	^
explorer/explorer.go:383:2: Consider preallocating `res` (prealloc)
	var res []explorer.Vote
	^
explorer/explorer.go:1231:2: Consider preallocating `peers` (prealloc)
	var peers []explorer.Node
	^
indexservice/indexer.go:181:2: Consider preallocating `transferHashes` (prealloc)
	var transferHashes []hash.Hash32B
	^
indexservice/indexer.go:277:2: Consider preallocating `voteHashes` (prealloc)
	var voteHashes []hash.Hash32B
	^
indexservice/indexer.go:373:2: Consider preallocating `executionHashes` (prealloc)
	var executionHashes []hash.Hash32B
	^
indexservice/indexer.go:468:2: Consider preallocating `actionHashes` (prealloc)
	var actionHashes []hash.Hash32B
	^
blockchain/block/utils.go:16:2: Consider preallocating `h` (prealloc)
	var h []hash.Hash32B
	^
consensus/scheme/rolldpos/rolldpos.go:256:2: Consider preallocating `candidatesAddress` (prealloc)
	var candidatesAddress []string
	^
consensus/scheme/rolldpos/rolldpos_test.go:703:1: cyclomatic complexity 45 of func `TestRollDPoSConsensus` is high (> 30) (gocyclo)
func TestRollDPoSConsensus(t *testing.T) {
^
blockchain/blockchain_test.go:41:1: cyclomatic complexity 38 of func `addTestingTsfBlocks` is high (> 30) (gocyclo)
func addTestingTsfBlocks(bc Blockchain) error {
^
blockchain/blockvalidator.go:89:1: cyclomatic complexity 34 of func `(*validator).verifyActions` is high (> 30) (gocyclo)
func (v *validator) verifyActions(blk *block.Block, containCoinbase bool) error {
^
explorer/explorer.go:1057:14: string `false` has 7 occurrences, make it a constant (goconst)
			succeed = "false"
			          ^
explorer/explorer.go:1055:14: string `true` has 7 occurrences, make it a constant (goconst)
		succeed := "true"
		           ^
p2p/agent.go:97:14: string `success` has 4 occurrences, make it a constant (goconst)
			status := "success"
			          ^
p2p/agent.go:99:14: string `failure` has 4 occurrences, make it a constant (goconst)
				status = "failure"
				         ^
blockchain/blockdao_test.go:603:3: ineffectual assignment to `tipHeight` (ineffassign)
		tipHeight, err = dao.getBlockchainHeight()
		^
db/trie/trie_test.go:41:7: `testTriePath` is unused (deadcode)
const testTriePath = "trie.test"
      ^
accounts/keystore/single_accountmanager_test.go:33:23: Error return value of `accountManager.Import` is not checked (errcheck)
	accountManager.Import(keyBytes)
	                     ^
accounts/keystore/single_accountmanager_test.go:64:23: Error return value of `accountManager.Import` is not checked (errcheck)
	accountManager.Import(keyBytes)
	                     ^
accounts/keystore/single_accountmanager_test.go:104:23: Error return value of `accountManager.Import` is not checked (errcheck)
	accountManager.Import(keyBytes)
	                     ^
action/action_test.go:41:17: Error return value of `nselp.LoadProto` is not checked (errcheck)
	nselp.LoadProto(selp.Proto())
	               ^
beacon/beacon.go:47:14: Error return value of `b.hash.Write` is not checked (errcheck)
	b.hash.Write(b.seed)
	            ^
blockchain/blockdao.go:670:22: Error return value of `batch.PutIfNotExists` is not checked (errcheck)
	batch.PutIfNotExists(blockNS, hash[:], serialized, "failed to put block")
	                    ^
blockchain/blockdao.go:803:23: Error return value of `batch.PutIfNotExists` is not checked (errcheck)
		batch.PutIfNotExists(blockAddressTransferMappingNS, senderKey, transferHash[:],
		                    ^
blockchain/blockdao.go:828:23: Error return value of `batch.PutIfNotExists` is not checked (errcheck)
		batch.PutIfNotExists(blockAddressTransferMappingNS, recipientKey, transferHash[:],
		                    ^
consensus/scheme/rolldpos/fsm_test.go:72:12: Error return value of `cfsm.Start` is not checked (errcheck)
	cfsm.Start(context.Background())
	          ^
consensus/scheme/rolldpos/fsm_test.go:73:17: Error return value of `cfsm.Stop` is not checked (errcheck)
	defer cfsm.Stop(context.Background())
	               ^
consensus/scheme/rolldpos/fsm_test.go:77:21: Error return value of `testutil.WaitUntil` is not checked (errcheck)
		testutil.WaitUntil(10*time.Millisecond, 100*time.Millisecond, func() (bool, error) {
		                  ^
consensus/scheme/standalone.go:47:9: Error return value of `s.pubCb` is not checked (errcheck)
	s.pubCb(blk)
	       ^
explorer/server_test.go:24:11: Error return value of `svr.Start` is not checked (errcheck)
	svr.Start(nil)
	         ^
indexservice/indexer.go:96:18: Error return value of `idx.rds.Transact` is not checked (errcheck)
	idx.rds.Transact(func(tx *sql.Tx) error {
	                ^
pkg/routine/delaytask_test.go:25:12: Error return value of `task.Start` is not checked (errcheck)
	task.Start(ctx)
	          ^
pkg/routine/delaytask_test.go:27:12: Error return value of `task.Stop` is not checked (errcheck)
		task.Stop(ctx)
		         ^
pkg/routine/delaytask_test.go:38:12: Error return value of `task.Start` is not checked (errcheck)
	task.Start(ctx)
	          ^
pkg/routine/delaytask_test.go:39:11: Error return value of `task.Stop` is not checked (errcheck)
	task.Stop(ctx)
	         ^
pkg/routine/recurringtask_test.go:37:12: Error return value of `task.Start` is not checked (errcheck)
	task.Start(ctx)
	          ^
pkg/routine/recurringtask_test.go:39:11: Error return value of `task.Stop` is not checked (errcheck)
	task.Stop(ctx)
	         ^
tools/addrgen/internal/cmd/createconfig.go:47:34: Error return value of `createConfigCmd.MarkFlagRequired` is not checked (errcheck)
	createConfigCmd.MarkFlagRequired("output-file")
	                                ^
blockchain/block/block.go:61:2: `endorsements` is unused (structcheck)
	endorsements    *endorsement.Set
	^
blockchain/block/block.go:62:2: `commitTimestamp` is unused (structcheck)
	commitTimestamp uint64
	^
consensus/scheme/rolldpos/rolldpos.go:73:2: `sync` is unused (structcheck)
	sync                   blocksync.BlockSync
	^
accounts/keystore/keystore_test.go:21: line is 158 characters (lll)
	pubKey1  = "336eb60a5741f585a8e81de64e071327a3b96c15af4af5723598a07b6121e8e813bbd0056ba71ae29c0d64252e913f60afaeb11059908b81ff27cbfa327fd371d35f5ec0cbc01705"
accounts/keystore/keystore_test.go:24: line is 158 characters (lll)
	pubKey2  = "f8261681ee6e3261eb4aa61123b0edc10bd95c9bb366c6b54348cfef3a055f2f3a3d800277cb15a2c13ac1a44ff1c05191c5729aa62955cb0303e80eeeb24885c8df033405fc5201"
action/actctx.go:85: line is 173 characters (lll)
	// the reason to set hash here, after set act context, is because some actions use envelope information in their proto define. for example transfer use des addr as Receipt.
action/action.go:30: line is 125 characters (lll)
// Action is the action can be Executed in protocols. The method is added to avoid mistakenly used empty interface as action.
action/action.go:268: line is 181 characters (lll)
	// the reason to set context here is because some actions use envelope information in their proto define. for example transfer use des addr as Receipt. This will change hash value.
action/createdeposit.go:26: line is 121 characters (lll)
// CreateDeposit represents the action to deposit the token from main-chain to sub-chain. The recipient address must be a
action/execution.go:39: line is 167 characters (lll)
func NewExecution(executorAddress string, contractAddress string, nonce uint64, amount *big.Int, gasLimit uint64, gasPrice *big.Int, data []byte) (*Execution, error) {
action/putblock.go:2: line is 230 characters (lll)
// This is an alpha (internal) release and is not suitable for production. This source code is provided 'as is' and no warranties are given as to title or non-infringement, merchantability or fitness for purpose and, to the extent
action/vote.go:32: line is 121 characters (lll)
func NewVote(nonce uint64, voterAddress string, voteeAddress string, gasLimit uint64, gasPrice *big.Int) (*Vote, error) {
action/transfer_test.go:27: line is 126 characters (lll)
	tsf, err := NewTransfer(0, big.NewInt(10), sender.RawAddress, recipient.RawAddress, []byte{}, uint64(100000), big.NewInt(10))
actpool/actpool.go:88: line is 121 characters (lll)
// Then starting from the current confirmed nonce, iteratively update pending nonce if nonces are consecutive and pending
actpool/actpool_test.go:32: line is 157 characters (lll)
	pubkeyA = "2c9ccbeb9ee91271f7e5c2103753be9c9edff847e1a51227df6a6b0765f31a4b424e84027b44a663950f013a88b8fd8cdc53b1eda1d4b73f9d9dc12546c8c87d68ff1435a0f8a006"
actpool/actpool_test.go:34: line is 157 characters (lll)
	pubkeyB = "881504d84a0659e14dcba59f24a98e71cda55b139615342668840c64678f1514941bbd053c7492fb9b719e6050cfa972efa491b79e11a1713824dda5f638fc0d9fa1b68be3c0f905"
actpool/actpool_test.go:36: line is 157 characters (lll)
	pubkeyC = "252fc7bc9a993b68dd7b13a00213c9cf4befe80da49940c52220f93c7147771ba2d783045cf0fbf2a86b32a62848befb96c0f38c0487a5ccc806ff28bb06d9faf803b93dda107003"
actpool/actpool_test.go:85: line is 142 characters (lll)
	unsignedTsf, err := action.NewTransfer(uint64(1), big.NewInt(1), addr1.RawAddress, addr1.RawAddress, []byte{}, uint64(100000), big.NewInt(0))
actpool/actpool_test.go:143: line is 128 characters (lll)
	// Test actpool status after adding a sequence of Tsfs/votes: need to check confirmed nonce, pending nonce, and pending balance
actpool/actpool_test.go:259: line is 169 characters (lll)
	creationExecution, err := action.NewExecution(addr1.RawAddress, action.EmptyAddress, uint64(5), big.NewInt(int64(0)), blockchain.GasLimit+100, big.NewInt(10), []byte{})
actpool/actpool_test.go:300: line is 130 characters (lll)
	createActPool := func(cfg config.ActPool) (*actPool, []action.SealedEnvelope, []action.SealedEnvelope, []action.SealedEnvelope) {
address/bech32/bech32_test.go:28: line is 128 characters (lll)
		{"s lit1checkupstagehandshakeupstreamerranterredcaperredp8hs2p", false},                   // invalid character (space) in hrp
address/bech32/bech32_test.go:29: line is 126 characters (lll)
		{"spl" + string(127) + "t1checkupstagehandshakeupstreamerranterredcaperred2y9e3w", false}, // invalid character (DEL) in hrp
address/bech32/bech32_test.go:30: line is 130 characters (lll)
		{"split1cheo2y9e2w", false},                                                               // invalid character (o) in data part
address/bech32/bech32_test.go:34: line is 136 characters (lll)
		{"11qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqsqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqc8247j", false}, // overall max length exceeded
beacon/beacon_test.go:25: line is 173 characters (lll)
	assert.Equal(t, decodeHash("39646536333036623038313538633432333333306637613237323433613161356362653339626664373634663037383138343337383832643231323431353637"), b.GetSeed())
beacon/beacon_test.go:28: line is 173 characters (lll)
	assert.Equal(t, decodeHash("19ef9c860e73e6dc17169dab7f331938b162834a94a034253c7958dca71dfcba9789148576b7b734398e82f43666bbc5eb41bebf7fdab305016d18aa98c25681"), b.GetSeed())
blockchain/blockchain.go:1122: line is 154 characters (lll)
func (bc *blockchain) runActions(acts block.RunnableActions, ws factory.WorkingSet, verify bool) (hash.Hash32B, map[hash.Hash32B]*action.Receipt, error) {
blockchain/blockchain_test.go:53: line is 175 characters (lll)
	sig, _ := hex.DecodeString("49fc01738d045ff21c9645baca8c90d476b7e56629c99fd5162a3f410c1a0e707ffa4c00e1a0087c4c7dd0fdc0cbe19030357a56e9d0fb506418e5e7b164ff0daefaedad704f5f01")
blockchain/blockchain_test.go:76: line is 170 characters (lll)
	tsf1, err := testutil.SignedTransfer(ta.Addrinfo["producer"], ta.Addrinfo["alfa"], 1, big.NewInt(20), []byte{}, testutil.TestGasLimit, big.NewInt(testutil.TestGasPrice))
blockchain/blockchain_test.go:80: line is 171 characters (lll)
	tsf2, err := testutil.SignedTransfer(ta.Addrinfo["producer"], ta.Addrinfo["bravo"], 2, big.NewInt(30), []byte{}, testutil.TestGasLimit, big.NewInt(testutil.TestGasPrice))
blockchain/blockchain_test.go:88: line is 171 characters (lll)
	tsf4, err := testutil.SignedTransfer(ta.Addrinfo["producer"], ta.Addrinfo["delta"], 4, big.NewInt(70), []byte{}, testutil.TestGasLimit, big.NewInt(testutil.TestGasPrice))
blockchain/blockchain_test.go:92: line is 171 characters (lll)
	tsf5, err := testutil.SignedTransfer(ta.Addrinfo["producer"], ta.Addrinfo["echo"], 5, big.NewInt(110), []byte{}, testutil.TestGasLimit, big.NewInt(testutil.TestGasPrice))
blockchain/blockchain_test.go:96: line is 177 characters (lll)
	tsf6, err := testutil.SignedTransfer(ta.Addrinfo["producer"], ta.Addrinfo["foxtrot"], 6, big.NewInt(50<<20), []byte{}, testutil.TestGasLimit, big.NewInt(testutil.TestGasPrice))
blockchain/blockchain_test.go:101: line is 127 characters (lll)
	blk, err = bc.MintNewBlock([]action.SealedEnvelope{tsf1, tsf2, tsf3, tsf4, tsf5, tsf6}, ta.Addrinfo["producer"], nil, nil, "")
blockchain/blockchain_test.go:114: line is 167 characters (lll)
	tsf1, err = testutil.SignedTransfer(ta.Addrinfo["charlie"], ta.Addrinfo["alfa"], 1, big.NewInt(1), []byte{}, testutil.TestGasLimit, big.NewInt(testutil.TestGasPrice))
blockchain/blockchain_test.go:118: line is 168 characters (lll)
	tsf2, err = testutil.SignedTransfer(ta.Addrinfo["charlie"], ta.Addrinfo["bravo"], 2, big.NewInt(1), []byte{}, testutil.TestGasLimit, big.NewInt(testutil.TestGasPrice))
blockchain/blockchain_test.go:122: line is 168 characters (lll)
	tsf3, err = testutil.SignedTransfer(ta.Addrinfo["charlie"], ta.Addrinfo["delta"], 3, big.NewInt(1), []byte{}, testutil.TestGasLimit, big.NewInt(testutil.TestGasPrice))
blockchain/blockchain_test.go:126: line is 167 characters (lll)
	tsf4, err = testutil.SignedTransfer(ta.Addrinfo["charlie"], ta.Addrinfo["echo"], 4, big.NewInt(1), []byte{}, testutil.TestGasLimit, big.NewInt(testutil.TestGasPrice))
blockchain/blockchain_test.go:147: line is 166 characters (lll)
	tsf1, err = testutil.SignedTransfer(ta.Addrinfo["delta"], ta.Addrinfo["bravo"], 1, big.NewInt(1), []byte{}, testutil.TestGasLimit, big.NewInt(testutil.TestGasPrice))
blockchain/blockchain_test.go:151: line is 165 characters (lll)
	tsf2, err = testutil.SignedTransfer(ta.Addrinfo["delta"], ta.Addrinfo["echo"], 2, big.NewInt(1), []byte{}, testutil.TestGasLimit, big.NewInt(testutil.TestGasPrice))
blockchain/blockchain_test.go:155: line is 168 characters (lll)
	tsf3, err = testutil.SignedTransfer(ta.Addrinfo["delta"], ta.Addrinfo["foxtrot"], 3, big.NewInt(1), []byte{}, testutil.TestGasLimit, big.NewInt(testutil.TestGasPrice))
blockchain/blockchain_test.go:159: line is 169 characters (lll)
	tsf4, err = testutil.SignedTransfer(ta.Addrinfo["delta"], ta.Addrinfo["producer"], 4, big.NewInt(1), []byte{}, testutil.TestGasLimit, big.NewInt(testutil.TestGasPrice))
blockchain/blockchain_test.go:176: line is 164 characters (lll)
	tsf1, err = testutil.SignedTransfer(ta.Addrinfo["echo"], ta.Addrinfo["alfa"], 1, big.NewInt(2), []byte{}, testutil.TestGasLimit, big.NewInt(testutil.TestGasPrice))
blockchain/blockchain_test.go:180: line is 165 characters (lll)
	tsf2, err = testutil.SignedTransfer(ta.Addrinfo["echo"], ta.Addrinfo["bravo"], 2, big.NewInt(2), []byte{}, testutil.TestGasLimit, big.NewInt(testutil.TestGasPrice))
blockchain/blockchain_test.go:188: line is 165 characters (lll)
	tsf4, err = testutil.SignedTransfer(ta.Addrinfo["echo"], ta.Addrinfo["delta"], 4, big.NewInt(2), []byte{}, testutil.TestGasLimit, big.NewInt(testutil.TestGasPrice))
blockchain/blockchain_test.go:200: line is 143 characters (lll)
	vote1, err := testutil.SignedVote(ta.Addrinfo["charlie"], ta.Addrinfo["charlie"], 6, testutil.TestGasLimit, big.NewInt(testutil.TestGasPrice))
blockchain/blockchain_test.go:204: line is 137 characters (lll)
	vote2, err := testutil.SignedVote(ta.Addrinfo["alfa"], ta.Addrinfo["alfa"], 1, testutil.TestGasLimit, big.NewInt(testutil.TestGasPrice))
blockchain/blockchain_test.go:899: line is 130 characters (lll)
			tsf, err := testutil.SignedTransfer(a, c, 1, big.NewInt(2), []byte{}, testutil.TestGasLimit, big.NewInt(testutil.TestGasPrice))
blockchain/blockchain_test.go:954: line is 129 characters (lll)
		tsf, err := testutil.SignedTransfer(a, c, 1, big.NewInt(2), []byte{}, testutil.TestGasLimit, big.NewInt(testutil.TestGasPrice))
blockchain/blockdao_test.go:62: line is 122 characters (lll)
		scbTsf3, err := action.Sign(elp, testaddress.Addrinfo["charlie"].RawAddress, testaddress.Addrinfo["charlie"].PrivateKey)
blockchain/blockdao_test.go:66: line is 122 characters (lll)
		vote1, err := testutil.SignedVote(testaddress.Addrinfo["alfa"], testaddress.Addrinfo["alfa"], 1, 100000, big.NewInt(10))
blockchain/blockdao_test.go:68: line is 124 characters (lll)
		vote2, err := testutil.SignedVote(testaddress.Addrinfo["bravo"], testaddress.Addrinfo["bravo"], 1, 100000, big.NewInt(10))
db/rds/rds_test.go:24:1: `cfg` is a global variable (gochecknoglobals)
var (
^
blocksync/blocksync_test.go:34:1: `opts` is a global variable (gochecknoglobals)
var opts = []Option{
^
explorer/explorer.go:51:1: `requestMtc` is a global variable (gochecknoglobals)
var (
^
pkg/hash/hash.go:22:1: `ZeroHash32B` is a global variable (gochecknoglobals)
var (
^
dispatcher/dispatcher.go:48:1: `requestMtc` is a global variable (gochecknoglobals)
var requestMtc = prometheus.NewCounterVec(
^
config/config.go:31:1: `_overwritePath` is a global variable (gochecknoglobals)
var (
^
config/config.go:55:1: `Default` is a global variable (gochecknoglobals)
var (
^
tools/addrgen/internal/cmd/root.go:16:1: `rootCmd` is a global variable (gochecknoglobals)
var rootCmd = &cobra.Command{
^
cli/iotc/cmd/self.go:16:1: `selfCmd` is a global variable (gochecknoglobals)
var selfCmd = &cobra.Command{
^
p2p/agent.go:29:1: `p2pMsgCounter` is a global variable (gochecknoglobals)
var (
^
logger/logger.go:25:1: `_levelStr` is a global variable (gochecknoglobals)
var (
^
logger/logger.go:33:1: `logger` is a global variable (gochecknoglobals)
var logger = zerolog.New(os.Stderr).Level(zerolog.InfoLevel).With().Timestamp().Logger()
^
pkg/keypair/keypair.go:22:1: `ZeroPublicKey` is a global variable (gochecknoglobals)
var (
^
address/address_v1.go:20:1: `V1` is a global variable (gochecknoglobals)
var V1 = v1{
^
server/itx/heartbeat.go:25:1: `heartbeatMtc` is a global variable (gochecknoglobals)
var heartbeatMtc = prometheus.NewGaugeVec(
^
cli/iotc/cmd/root.go:23:1: `address` is a global variable (gochecknoglobals)
var (
^
cli/iotc/cmd/root.go:28:1: `rootCmd` is a global variable (gochecknoglobals)
var rootCmd = &cobra.Command{
^
blocksync/slidingwindow.go:28:1: `WindowSize` is a global variable (gochecknoglobals)
var WindowSize uint64 = 8
^
crypto/ec160.go:24:1: `EC160` is a global variable (gochecknoglobals)
var EC160 ec160
^
pkg/enc/enc.go:12:1: `MachineEndian` is a global variable (gochecknoglobals)
var MachineEndian = binary.LittleEndian
^
iotxaddress/iotxaddress.go:32:1: `IsTestnet` is a global variable (gochecknoglobals)
var (
^
address/bech32/bech32.go:28:1: `gen` is a global variable (gochecknoglobals)
var gen = []int{0x3b6a57b2, 0x26508e6d, 0x1ea119fa, 0x3d4233dd, 0x2a1462b3}
^
consensus/scheme/rolldpos/fsm.go:29:1: `consensusMtc` is a global variable (gochecknoglobals)
var (
^
consensus/scheme/rolldpos/fsm.go:72:1: `consensusStates` is a global variable (gochecknoglobals)
var (
^
address/address.go:33:1: `isTestNet` is a global variable (gochecknoglobals)
var isTestNet bool
^
state/account.go:19:1: `EmptyAccount` is a global variable (gochecknoglobals)
var (
^
db/db_test.go:21:1: `bucket1` is a global variable (gochecknoglobals)
var (
^
indexservice/indexer_test.go:26:1: `cfg` is a global variable (gochecknoglobals)
var (
^
cli/iotc/cmd/transfers.go:17:1: `limit` is a global variable (gochecknoglobals)
var limit int
^
cli/iotc/cmd/transfers.go:20:1: `transfersCmd` is a global variable (gochecknoglobals)
var transfersCmd = &cobra.Command{
^
consensus/scheme/rolldpos/fsm_test.go:40:1: `testAddrs` is a global variable (gochecknoglobals)
var testAddrs = []*iotxaddress.Address{
^
crypto/bls.go:33:1: `BLS` is a global variable (gochecknoglobals)
var (
^
server/main.go:29:1: `recoveryHeight` is a global variable (gochecknoglobals)
var recoveryHeight int
^
blockchain/genesis.go:75:1: `Gen` is a global variable (gochecknoglobals)
var Gen = &Genesis{
^
cli/iotc/cmd/balance.go:18:1: `balanceCmd` is a global variable (gochecknoglobals)
var balanceCmd = &cobra.Command{
^
tools/addrgen/internal/cmd/generate.go:20:1: `generateCmd` is a global variable (gochecknoglobals)
var generateCmd = &cobra.Command{
^
tools/addrgen/internal/cmd/generate.go:29:1: `_addrNum` is a global variable (gochecknoglobals)
var _addrNum int
^
consensus/scheme/rolldpos/rolldpos.go:38:1: `timeSlotMtc` is a global variable (gochecknoglobals)
var (
^
crypto/dkg.go:17:1: `DKG` is a global variable (gochecknoglobals)
var DKG dkg
^
cli/iotc/cmd/height.go:18:1: `heightCmd` is a global variable (gochecknoglobals)
var heightCmd = &cobra.Command{
^
actpool/actpool_test.go:49:1: `chainID` is a global variable (gochecknoglobals)
var (
^
crypto/ec283.go:31:1: `EC283` is a global variable (gochecknoglobals)
var EC283 ec283
^
blockchain/blockdao.go:42:1: `hashPrefix` is a global variable (gochecknoglobals)
var (
^
db/trie/trie_test.go:19:1: `ham` is a global variable (gochecknoglobals)
var (
^
action/transfer_test.go:18:1: `chainid` is a global variable (gochecknoglobals)
var chainid = []byte{0x00, 0x00, 0x00, 0x01}
^
tools/addrgen/internal/cmd/createconfig.go:20:1: `createConfigCmd` is a global variable (gochecknoglobals)
var createConfigCmd = &cobra.Command{
^
tools/addrgen/internal/cmd/createconfig.go:43:1: `_outputFile` is a global variable (gochecknoglobals)
var _outputFile string
^
crypto/cryptosort.go:18:1: `CryptoSeed` is a global variable (gochecknoglobals)
var (
^
cli/iotc/cmd/details.go:18:1: `detailsCmd` is a global variable (gochecknoglobals)
var detailsCmd = &cobra.Command{
^
config/config.go:166:8: struct of size 128 bytes could be of size 112 bytes (maligned)
	Chain struct {
	      ^
dispatcher/dispatcher.go:61:15: struct of size 24 bytes could be of size 16 bytes (maligned)
type blockMsg struct {
              ^
explorer/explorer.go:61:1: don't use `init` function (gochecknoinits)
func init() {
^
dispatcher/dispatcher.go:56:1: don't use `init` function (gochecknoinits)
func init() {
^
config/config.go:25:1: don't use `init` function (gochecknoinits)
func init() {
^
actpool/actpool_test.go:217:60: unnecessary conversion (unconvert)
		nTsf, err := testutil.SignedTransfer(addr1, addr2, uint64(i), big.NewInt(50), nil, uint64(0), big.NewInt(0))
		                                                         ^
db/db_badger.go:219:24: unnecessary conversion (unconvert)
			k = append(k, []byte(key[i])...)
			                    ^
tools/util/injectorutil.go:100:43: unnecessary conversion (unconvert)
	tick := time.Tick(time.Duration(1/float64(aps)*1000000) * time.Microsecond)
	                                         ^
blockchain/blockdao.go:1189: 1189-1255 lines are duplicate of `blockchain/blockdao.go:1332-1398` (dupl)
func deleteTransfers(dao *blockDAO, blk *block.Block, batch db.KVStoreBatch) error {
	transfers, _, _ := action.ClassifyActions(blk.Actions)
	// First get the total count of transfers by sender and recipient respectively in the block
	senderCount := make(map[string]uint64)
	recipientCount := make(map[string]uint64)
	for _, transfer := range transfers {
		senderCount[transfer.Sender()]++
		recipientCount[transfer.Recipient()]++
	}
	// Roll back the status of address -> transferCount mapping to the previous block
	for sender, count := range senderCount {
		senderTransferCount, err := dao.getTransferCountBySenderAddress(sender)
		if err != nil {
			return errors.Wrapf(err, "for sender %x", sender)
		}
		senderTransferCountKey := append(transferFromPrefix, sender...)
		senderCount[sender] = senderTransferCount - count
		batch.Put(blockAddressTransferCountMappingNS, senderTransferCountKey,
			byteutil.Uint64ToBytes(senderCount[sender]), "failed to update transfer count for sender %x", sender)
	}
	for recipient, count := range recipientCount {
		recipientTransferCount, err := dao.getTransferCountByRecipientAddress(recipient)
		if err != nil {
			return errors.Wrapf(err, "for recipient %x", recipient)
		}
		recipientTransferCountKey := append(transferToPrefix, recipient...)
		recipientCount[recipient] = recipientTransferCount - count
		batch.Put(blockAddressTransferCountMappingNS, recipientTransferCountKey,
			byteutil.Uint64ToBytes(recipientCount[recipient]),
			"failed to update transfer count for recipient %x", recipient)
	}

	senderDelta := map[string]uint64{}
	recipientDelta := map[string]uint64{}

	for _, transfer := range transfers {
		transferHash := transfer.Hash()

		if delta, ok := senderDelta[transfer.Sender()]; ok {
			senderCount[transfer.Sender()] += delta
			senderDelta[transfer.Sender()] = senderDelta[transfer.Sender()] + 1
		} else {
			senderDelta[transfer.Sender()] = 1
		}

		// Delete new transfer from sender
		senderKey := append(transferFromPrefix, transfer.Sender()...)
		senderKey = append(senderKey, byteutil.Uint64ToBytes(senderCount[transfer.Sender()])...)
		batch.Delete(blockAddressTransferMappingNS, senderKey, "failed to delete transfer hash %x for sender %x",
			transfer.Hash(), transfer.Sender())

		if delta, ok := recipientDelta[transfer.Recipient()]; ok {
			recipientCount[transfer.Recipient()] += delta
			recipientDelta[transfer.Recipient()] = recipientDelta[transfer.Recipient()] + 1
		} else {
			recipientDelta[transfer.Recipient()] = 1
		}

		// Delete new transfer to recipient
		recipientKey := append(transferToPrefix, transfer.Recipient()...)
		recipientKey = append(recipientKey, byteutil.Uint64ToBytes(recipientCount[transfer.Recipient()])...)
		batch.Delete(blockAddressTransferMappingNS, recipientKey, "failed to delete transfer hash %x for recipient %x",
			transferHash, transfer.Recipient())
	}

	return nil
}
blockchain/blockdao.go:1332: 1332-1398 lines are duplicate of `blockchain/blockdao.go:1189-1255` (dupl)
func deleteExecutions(dao *blockDAO, blk *block.Block, batch db.KVStoreBatch) error {
	_, _, executions := action.ClassifyActions(blk.Actions)
	// First get the total count of executions by executor and contract respectively in the block
	executorCount := make(map[string]uint64)
	contractCount := make(map[string]uint64)
	for _, execution := range executions {
		executorCount[execution.Executor()]++
		contractCount[execution.Contract()]++
	}
	// Roll back the status of address -> executionCount mapping to the previous block
	for executor, count := range executorCount {
		executorExecutionCount, err := dao.getExecutionCountByExecutorAddress(executor)
		if err != nil {
			return errors.Wrapf(err, "for executor %x", executor)
		}
		executorExecutionCountKey := append(executionFromPrefix, executor...)
		executorCount[executor] = executorExecutionCount - count
		batch.Put(blockAddressExecutionCountMappingNS, executorExecutionCountKey,
			byteutil.Uint64ToBytes(executorCount[executor]),
			"failed to update execution count for executor %x", executor)
	}
	for contract, count := range contractCount {
		contractExecutionCount, err := dao.getExecutionCountByContractAddress(contract)
		if err != nil {
			return errors.Wrapf(err, "for contract %x", contract)
		}
		contractExecutionCountKey := append(executionToPrefix, contract...)
		contractCount[contract] = contractExecutionCount - count
		batch.Put(blockAddressExecutionCountMappingNS, contractExecutionCountKey,
			byteutil.Uint64ToBytes(contractCount[contract]), "failed to update execution count for contract %x", contract)
	}

	executorDelta := map[string]uint64{}
	contractDelta := map[string]uint64{}

	for _, execution := range executions {
		executionHash := execution.Hash()

		if delta, ok := executorDelta[execution.Executor()]; ok {
			executorCount[execution.Executor()] += delta
			executorDelta[execution.Executor()] = executorDelta[execution.Executor()] + 1
		} else {
			executorDelta[execution.Executor()] = 1
		}

		// Delete new execution from executor
		executorKey := append(executionFromPrefix, execution.Executor()...)
		executorKey = append(executorKey, byteutil.Uint64ToBytes(executorCount[execution.Executor()])...)
		batch.Delete(blockAddressExecutionMappingNS, executorKey, "failed to delete execution hash %x for executor %x",
			execution.Hash(), execution.Executor())

		if delta, ok := contractDelta[execution.Contract()]; ok {
			contractCount[execution.Contract()] += delta
			contractDelta[execution.Contract()] = contractDelta[execution.Contract()] + 1
		} else {
			contractDelta[execution.Contract()] = 1
		}

		// Delete new execution to contract
		contractKey := append(executionToPrefix, execution.Contract()...)
		contractKey = append(contractKey, byteutil.Uint64ToBytes(contractCount[execution.Contract()])...)
		batch.Delete(blockAddressExecutionMappingNS, contractKey, "failed to delete execution hash %x for contract %x",
			executionHash, execution.Contract())
	}

	return nil
}
explorer/explorer.go:1676: 1676-1711 lines are duplicate of `explorer/explorer.go:1738-1773` (dupl)
func getCreateDeposit(
	bc blockchain.Blockchain,
	ap actpool.ActPool,
	createDepositHash hash.Hash32B,
) (explorer.CreateDeposit, error) {
	pending := false
	var selp action.SealedEnvelope
	var err error
	selp, err = bc.GetActionByActionHash(createDepositHash)
	if err != nil {
		// Try to fetch pending create deposit from actpool
		selp, err = ap.GetActionByHash(createDepositHash)
		if err != nil {
			return explorer.CreateDeposit{}, err
		}
		pending = true
	}

	// Fetch from block
	blkHash, err := bc.GetBlockHashByActionHash(createDepositHash)
	if err != nil {
		return explorer.CreateDeposit{}, err
	}
	blk, err := bc.GetBlockByHash(blkHash)
	if err != nil {
		return explorer.CreateDeposit{}, err
	}

	cd, err := castActionToCreateDeposit(selp, pending)
	if err != nil {
		return explorer.CreateDeposit{}, err
	}
	cd.Timestamp = int64(blk.ConvertToBlockHeaderPb().Timestamp)
	cd.BlockID = hex.EncodeToString(blkHash[:])
	return cd, nil
}
explorer/explorer.go:1738: 1738-1773 lines are duplicate of `explorer/explorer.go:1676-1711` (dupl)
func getSettleDeposit(
	bc blockchain.Blockchain,
	ap actpool.ActPool,
	settleDepositHash hash.Hash32B,
) (explorer.SettleDeposit, error) {
	pending := false
	var selp action.SealedEnvelope
	var err error
	selp, err = bc.GetActionByActionHash(settleDepositHash)
	if err != nil {
		// Try to fetch pending settle deposit from actpool
		selp, err = ap.GetActionByHash(settleDepositHash)
		if err != nil {
			return explorer.SettleDeposit{}, err
		}
		pending = true
	}

	// Fetch from block
	blkHash, err := bc.GetBlockHashByActionHash(settleDepositHash)
	if err != nil {
		return explorer.SettleDeposit{}, err
	}
	blk, err := bc.GetBlockByHash(blkHash)
	if err != nil {
		return explorer.SettleDeposit{}, err
	}

	sd, err := castActionToSettleDeposit(selp, pending)
	if err != nil {
		return explorer.SettleDeposit{}, err
	}
	sd.Timestamp = int64(blk.ConvertToBlockHeaderPb().Timestamp)
	sd.BlockID = hex.EncodeToString(blkHash[:])
	return sd, nil
}
explorer/explorer.go:201: 201-243 lines are duplicate of `explorer/explorer.go:382-424` (dupl)
func (exp *Service) GetTransfersByAddress(address string, offset int64, limit int64) ([]explorer.Transfer, error) {
	var res []explorer.Transfer
	var transfers []hash.Hash32B
	if exp.cfg.UseRDS {
		transferHistory, err := exp.idx.Indexer().GetTransferHistory(address)
		if err != nil {
			return []explorer.Transfer{}, err
		}
		transfers = append(transfers, transferHistory...)
	} else {
		transfersFromAddress, err := exp.bc.GetTransfersFromAddress(address)
		if err != nil {
			return []explorer.Transfer{}, err
		}

		transfersToAddress, err := exp.bc.GetTransfersToAddress(address)
		if err != nil {
			return []explorer.Transfer{}, err
		}

		transfersFromAddress = append(transfersFromAddress, transfersToAddress...)
		transfers = append(transfers, transfersFromAddress...)
	}

	for i, transferHash := range transfers {
		if int64(i) < offset {
			continue
		}

		if int64(len(res)) >= limit {
			break
		}

		explorerTransfer, err := getTransfer(exp.bc, exp.ap, transferHash, exp.idx, exp.cfg.UseRDS)
		if err != nil {
			return []explorer.Transfer{}, err
		}

		res = append(res, explorerTransfer)
	}

	return res, nil
}
explorer/explorer.go:382: 382-424 lines are duplicate of `explorer/explorer.go:565-607` (dupl)
func (exp *Service) GetVotesByAddress(address string, offset int64, limit int64) ([]explorer.Vote, error) {
	var res []explorer.Vote
	var votes []hash.Hash32B
	if exp.cfg.UseRDS {
		voteHistory, err := exp.idx.Indexer().GetVoteHistory(address)
		if err != nil {
			return []explorer.Vote{}, err
		}
		votes = append(votes, voteHistory...)
	} else {
		votesFromAddress, err := exp.bc.GetVotesFromAddress(address)
		if err != nil {
			return []explorer.Vote{}, err
		}

		votesToAddress, err := exp.bc.GetVotesToAddress(address)
		if err != nil {
			return []explorer.Vote{}, err
		}

		votesFromAddress = append(votesFromAddress, votesToAddress...)
		votes = append(votes, votesFromAddress...)
	}

	for i, voteHash := range votes {
		if int64(i) < offset {
			continue
		}

		if int64(len(res)) >= limit {
			break
		}

		explorerVote, err := getVote(exp.bc, exp.ap, voteHash, exp.idx, exp.cfg.UseRDS)
		if err != nil {
			return []explorer.Vote{}, err
		}

		res = append(res, explorerVote)
	}

	return res, nil
}
explorer/explorer.go:565: 565-607 lines are duplicate of `explorer/explorer.go:201-243` (dupl)
func (exp *Service) GetExecutionsByAddress(address string, offset int64, limit int64) ([]explorer.Execution, error) {
	var res []explorer.Execution
	var executions []hash.Hash32B
	if exp.cfg.UseRDS {
		executionHistory, err := exp.idx.Indexer().GetExecutionHistory(address)
		if err != nil {
			return []explorer.Execution{}, err
		}
		executions = append(executions, executionHistory...)
	} else {
		executionsFromAddress, err := exp.bc.GetExecutionsFromAddress(address)
		if err != nil {
			return []explorer.Execution{}, err
		}

		executionsToAddress, err := exp.bc.GetExecutionsToAddress(address)
		if err != nil {
			return []explorer.Execution{}, err
		}

		executionsFromAddress = append(executionsFromAddress, executionsToAddress...)
		executions = append(executions, executionsFromAddress...)
	}

	for i, executionHash := range executions {
		if int64(i) < offset {
			continue
		}

		if int64(len(res)) >= limit {
			break
		}

		explorerExecution, err := getExecution(exp.bc, exp.ap, executionHash, exp.idx, exp.cfg.UseRDS)
		if err != nil {
			return []explorer.Execution{}, err
		}

		res = append(res, explorerExecution)
	}

	return res, nil
}
indexservice/indexer.go:205: 205-232 lines are duplicate of `indexservice/indexer.go:301-328` (dupl)
func (idx *Indexer) GetBlockByTransfer(transferHash hash.Hash32B) (hash.Hash32B, error) {
	getQuery := "SELECT * FROM transfer_to_block WHERE node_address=? AND transfer_hash=?"
	db := idx.rds.GetDB()

	stmt, err := db.Prepare(getQuery)
	if err != nil {
		return hash.ZeroHash32B, errors.Wrapf(err, "failed to prepare get query")
	}

	rows, err := stmt.Query(idx.hexEncodedNodeAddr, hex.EncodeToString(transferHash[:]))
	if err != nil {
		return hash.ZeroHash32B, errors.Wrapf(err, "failed to execute get query")
	}

	var transferToBlock TransferToBlock
	parsedRows, err := rds.ParseRows(rows, &transferToBlock)
	if err != nil {
		return hash.ZeroHash32B, errors.Wrapf(err, "failed to parse results")
	}

	if len(parsedRows) == 0 {
		return hash.ZeroHash32B, ErrNotExist
	}

	var hash hash.Hash32B
	copy(hash[:], parsedRows[0].(*TransferToBlock).BlockHash)
	return hash, nil
}
indexservice/indexer.go:301: 301-328 lines are duplicate of `indexservice/indexer.go:397-424` (dupl)
func (idx *Indexer) GetBlockByVote(voteHash hash.Hash32B) (hash.Hash32B, error) {
	getQuery := "SELECT * FROM vote_to_block WHERE node_address=? AND vote_hash=?"
	db := idx.rds.GetDB()

	stmt, err := db.Prepare(getQuery)
	if err != nil {
		return hash.ZeroHash32B, errors.Wrapf(err, "failed to prepare get query")
	}

	rows, err := stmt.Query(idx.hexEncodedNodeAddr, hex.EncodeToString(voteHash[:]))
	if err != nil {
		return hash.ZeroHash32B, errors.Wrapf(err, "failed to execute get query")
	}

	var voteToBlock VoteToBlock
	parsedRows, err := rds.ParseRows(rows, &voteToBlock)
	if err != nil {
		return hash.ZeroHash32B, errors.Wrapf(err, "failed to parse results")
	}

	if len(parsedRows) == 0 {
		return hash.ZeroHash32B, ErrNotExist
	}

	var hash hash.Hash32B
	copy(hash[:], parsedRows[0].(*VoteToBlock).BlockHash)
	return hash, nil
}
indexservice/indexer.go:397: 397-424 lines are duplicate of `indexservice/indexer.go:491-518` (dupl)
func (idx *Indexer) GetBlockByExecution(executionHash hash.Hash32B) (hash.Hash32B, error) {
	getQuery := "SELECT * FROM execution_to_block WHERE node_address=? AND execution_hash=?"
	db := idx.rds.GetDB()

	stmt, err := db.Prepare(getQuery)
	if err != nil {
		return hash.ZeroHash32B, errors.Wrapf(err, "failed to prepare get query")
	}

	rows, err := stmt.Query(idx.hexEncodedNodeAddr, hex.EncodeToString(executionHash[:]))
	if err != nil {
		return hash.ZeroHash32B, errors.Wrapf(err, "failed to execute get query")
	}

	var executionToBlock ExecutionToBlock
	parsedRows, err := rds.ParseRows(rows, &executionToBlock)
	if err != nil {
		return hash.ZeroHash32B, errors.Wrapf(err, "failed to parse results")
	}

	if len(parsedRows) == 0 {
		return hash.ZeroHash32B, ErrNotExist
	}

	var hash hash.Hash32B
	copy(hash[:], parsedRows[0].(*ExecutionToBlock).BlockHash)
	return hash, nil
}
indexservice/indexer.go:491: 491-518 lines are duplicate of `indexservice/indexer.go:205-232` (dupl)
func (idx *Indexer) GetBlockByAction(actionHash hash.Hash32B) (hash.Hash32B, error) {
	getQuery := "SELECT * FROM action_to_block WHERE node_address=? AND action_hash=?"
	db := idx.rds.GetDB()

	stmt, err := db.Prepare(getQuery)
	if err != nil {
		return hash.ZeroHash32B, errors.Wrapf(err, "failed to prepare get query")
	}

	rows, err := stmt.Query(idx.hexEncodedNodeAddr, hex.EncodeToString(actionHash[:]))
	if err != nil {
		return hash.ZeroHash32B, errors.Wrapf(err, "failed to execute get query")
	}

	var actionToBlock ActionToBlock
	parsedRows, err := rds.ParseRows(rows, &actionToBlock)
	if err != nil {
		return hash.ZeroHash32B, errors.Wrapf(err, "failed to parse results")
	}

	if len(parsedRows) == 0 {
		return hash.ZeroHash32B, ErrNotExist
	}

	var hash hash.Hash32B
	copy(hash[:], parsedRows[0].(*ActionToBlock).BlockHash)
	return hash, nil
}
explorer/explorer.go:281: 281-317 lines are duplicate of `explorer/explorer.go:462-499` (dupl)
func (exp *Service) GetTransfersByBlockID(blkID string, offset int64, limit int64) ([]explorer.Transfer, error) {
	var res []explorer.Transfer
	bytes, err := hex.DecodeString(blkID)

	if err != nil {
		return []explorer.Transfer{}, err
	}
	var hash hash.Hash32B
	copy(hash[:], bytes)

	blk, err := exp.bc.GetBlockByHash(hash)
	if err != nil {
		return []explorer.Transfer{}, err
	}

	var num int
	for _, selp := range blk.Actions {
		if _, ok := selp.Action().(*action.Transfer); !ok {
			continue
		}
		if int64(num) < offset {
			continue
		}
		if int64(len(res)) >= limit {
			break
		}
		explorerTransfer, err := convertTsfToExplorerTsf(selp, false)
		if err != nil {
			return []explorer.Transfer{}, errors.Wrapf(err, "failed to convert transfer %v to explorer's JSON transfer", selp)
		}
		explorerTransfer.Timestamp = int64(blk.ConvertToBlockHeaderPb().Timestamp)
		explorerTransfer.BlockID = blkID
		res = append(res, explorerTransfer)
		num++
	}
	return res, nil
}
explorer/explorer.go:462: 462-499 lines are duplicate of `explorer/explorer.go:643-681` (dupl)
func (exp *Service) GetVotesByBlockID(blkID string, offset int64, limit int64) ([]explorer.Vote, error) {
	var res []explorer.Vote
	bytes, err := hex.DecodeString(blkID)
	if err != nil {
		return []explorer.Vote{}, err
	}
	var hash hash.Hash32B
	copy(hash[:], bytes)

	blk, err := exp.bc.GetBlockByHash(hash)
	if err != nil {
		return []explorer.Vote{}, err
	}

	var num int
	for _, selp := range blk.Actions {
		if _, ok := selp.Action().(*action.Vote); !ok {
			continue
		}
		if int64(num) < offset {
			continue
		}

		if int64(len(res)) >= limit {
			break
		}

		explorerVote, err := convertVoteToExplorerVote(selp, false)
		if err != nil {
			return []explorer.Vote{}, errors.Wrapf(err, "failed to convert vote %v to explorer's JSON vote", selp)
		}
		explorerVote.Timestamp = int64(blk.ConvertToBlockHeaderPb().Timestamp)
		explorerVote.BlockID = blkID
		res = append(res, explorerVote)
		num++
	}
	return res, nil
}
explorer/explorer.go:643: 643-681 lines are duplicate of `explorer/explorer.go:281-317` (dupl)
func (exp *Service) GetExecutionsByBlockID(blkID string, offset int64, limit int64) ([]explorer.Execution, error) {
	var res []explorer.Execution
	bytes, err := hex.DecodeString(blkID)

	if err != nil {
		return []explorer.Execution{}, err
	}
	var hash hash.Hash32B
	copy(hash[:], bytes)

	blk, err := exp.bc.GetBlockByHash(hash)
	if err != nil {
		return []explorer.Execution{}, err
	}

	var num int
	for _, selp := range blk.Actions {
		if _, ok := selp.Action().(*action.Execution); !ok {
			continue
		}
		if int64(num) < offset {
			continue
		}

		if int64(len(res)) >= limit {
			break
		}

		explorerExecution, err := convertExecutionToExplorerExecution(selp, false)
		if err != nil {
			return []explorer.Execution{}, errors.Wrapf(err, "failed to convert execution %v to explorer's JSON execution", selp)
		}
		explorerExecution.Timestamp = int64(blk.ConvertToBlockHeaderPb().Timestamp)
		explorerExecution.BlockID = blkID
		res = append(res, explorerExecution)
		num++
	}
	return res, nil
}
crypto/ec160_test.go:7: 7-42 lines are duplicate of `crypto/ec283_test.go:7-42` (dupl)
package crypto

import (
	"testing"

	"github.com/stretchr/testify/require"
)

func TestECDSA160SignVerify(t *testing.T) {
	require := require.New(t)
	pub, pri, err := EC160.NewKeyPair()
	require.NoError(err)

	message := []byte("hello iotex message")
	sig := EC160.Sign(pri, message)
	require.True(EC160.Verify(pub, message, sig))

	wrongMessage := []byte("wrong message")
	require.False(EC160.Verify(pub, wrongMessage, sig))
}

func TestECDSA160PubKeyGeneration(t *testing.T) {
	require := require.New(t)
	expectedPuk, pri, err := EC160.NewKeyPair()
	require.NoError(err)

	actualPuk, err := EC160.NewPubKey(pri)
	require.NoError(err)
	require.Equal(expectedPuk, actualPuk)
	message := []byte("hello iotex message")
	sig := EC160.Sign(pri, message)
	require.True(EC160.Verify(actualPuk, message, sig))

	wrongMessage := []byte("wrong message")
	require.False(EC160.Verify(actualPuk, wrongMessage, sig))
}
crypto/ec283_test.go:7: 7-42 lines are duplicate of `crypto/ec160_test.go:7-42` (dupl)
package crypto

import (
	"testing"

	"github.com/stretchr/testify/require"
)

func TestSignVerify(t *testing.T) {
	require := require.New(t)
	pub, pri, err := EC283.NewKeyPair()
	require.NoError(err)

	message := []byte("hello iotex message")
	sig := EC283.Sign(pri, message)
	require.True(EC283.Verify(pub, message, sig))

	wrongMessage := []byte("wrong message")
	require.False(EC283.Verify(pub, wrongMessage, sig))
}

func TestPubKeyGeneration(t *testing.T) {
	require := require.New(t)
	expectedPuk, pri, err := EC283.NewKeyPair()
	require.NoError(err)

	actualPuk, err := EC283.NewPubKey(pri)
	require.NoError(err)
	require.Equal(expectedPuk, actualPuk)
	message := []byte("hello iotex message")
	sig := EC283.Sign(pri, message)
	require.True(EC283.Verify(actualPuk, message, sig))

	wrongMessage := []byte("wrong message")
	require.False(EC283.Verify(actualPuk, wrongMessage, sig))
}
blockchain/block/block_test.go:175: 175-218 lines are duplicate of `consensus/scheme/rolldpos/subchain_test.go:34-77` (dupl)
	require.NoError(t, blk.ConvertFromBlockPb(&iproto.BlockPb{
		Header: &iproto.BlockHeaderPb{
			Version: version.ProtocolVersion,
			Height:  123456789,
		},
		Actions: []*iproto.ActionPb{
			{
				Action: &iproto.ActionPb_Transfer{
					Transfer: &iproto.TransferPb{},
				},
				Sender:       sender.RawAddress,
				SenderPubKey: sender.PublicKey[:],
				Version:      version.ProtocolVersion,
				Nonce:        101,
			},
			{
				Action: &iproto.ActionPb_Transfer{
					Transfer: &iproto.TransferPb{},
				},
				Sender:       sender.RawAddress,
				SenderPubKey: sender.PublicKey[:],
				Version:      version.ProtocolVersion,
				Nonce:        102,
			},
			{
				Action: &iproto.ActionPb_Vote{
					Vote: &iproto.VotePb{},
				},
				Sender:       sender.RawAddress,
				SenderPubKey: sender.PublicKey[:],
				Version:      version.ProtocolVersion,
				Nonce:        103,
			},
			{
				Action: &iproto.ActionPb_Vote{
					Vote: &iproto.VotePb{},
				},
				Sender:       sender.RawAddress,
				SenderPubKey: sender.PublicKey[:],
				Version:      version.ProtocolVersion,
				Nonce:        104,
			},
		},
	}))
consensus/scheme/rolldpos/subchain_test.go:34: 34-77 lines are duplicate of `blockchain/block/block_test.go:175-218` (dupl)
	blkpb := &iproto.BlockPb{
		Header: &iproto.BlockHeaderPb{
			Version: version.ProtocolVersion,
			Height:  123456789,
		},
		Actions: []*iproto.ActionPb{
			{
				Action: &iproto.ActionPb_Transfer{
					Transfer: &iproto.TransferPb{},
				},
				Sender:       addr.RawAddress,
				SenderPubKey: addr.PublicKey[:],
				Version:      version.ProtocolVersion,
				Nonce:        101,
			},
			{
				Action: &iproto.ActionPb_Transfer{
					Transfer: &iproto.TransferPb{},
				},
				Sender:       addr.RawAddress,
				SenderPubKey: addr.PublicKey[:],
				Version:      version.ProtocolVersion,
				Nonce:        102,
			},
			{
				Action: &iproto.ActionPb_Vote{
					Vote: &iproto.VotePb{},
				},
				Sender:       addr.RawAddress,
				SenderPubKey: addr.PublicKey[:],
				Version:      version.ProtocolVersion,
				Nonce:        103,
			},
			{
				Action: &iproto.ActionPb_Vote{
					Vote: &iproto.VotePb{},
				},
				Sender:       addr.RawAddress,
				SenderPubKey: addr.PublicKey[:],
				Version:      version.ProtocolVersion,
				Nonce:        104,
			},
		},
	}
blockchain/blockdao.go:780: 780-839 lines are duplicate of `blockchain/blockdao.go:910-967` (dupl)
func putTransfers(dao *blockDAO, blk *block.Block, batch db.KVStoreBatch) error {
	senderDelta := map[string]uint64{}
	recipientDelta := map[string]uint64{}

	transfers, _, _ := action.ClassifyActions(blk.Actions)
	for _, transfer := range transfers {
		transferHash := transfer.Hash()

		// get transfers count for sender
		senderTransferCount, err := dao.getTransferCountBySenderAddress(transfer.Sender())
		if err != nil {
			return errors.Wrapf(err, "for sender %x", transfer.Sender())
		}
		if delta, ok := senderDelta[transfer.Sender()]; ok {
			senderTransferCount += delta
			senderDelta[transfer.Sender()] = senderDelta[transfer.Sender()] + 1
		} else {
			senderDelta[transfer.Sender()] = 1
		}

		// put new transfer to sender
		senderKey := append(transferFromPrefix, transfer.Sender()...)
		senderKey = append(senderKey, byteutil.Uint64ToBytes(senderTransferCount)...)
		batch.PutIfNotExists(blockAddressTransferMappingNS, senderKey, transferHash[:],
			"failed to put transfer hash %x for sender %x", transfer.Hash(), transfer.Sender())

		// update sender transfers count
		senderTransferCountKey := append(transferFromPrefix, transfer.Sender()...)
		batch.Put(blockAddressTransferCountMappingNS, senderTransferCountKey,
			byteutil.Uint64ToBytes(senderTransferCount+1), "failed to bump transfer count %x for sender %x",
			transfer.Hash(), transfer.Sender())

		// get transfers count for recipient
		recipientTransferCount, err := dao.getTransferCountByRecipientAddress(transfer.Recipient())
		if err != nil {
			return errors.Wrapf(err, "for recipient %x", transfer.Recipient())
		}
		if delta, ok := recipientDelta[transfer.Recipient()]; ok {
			recipientTransferCount += delta
			recipientDelta[transfer.Recipient()] = recipientDelta[transfer.Recipient()] + 1
		} else {
			recipientDelta[transfer.Recipient()] = 1
		}

		// put new transfer to recipient
		recipientKey := append(transferToPrefix, transfer.Recipient()...)
		recipientKey = append(recipientKey, byteutil.Uint64ToBytes(recipientTransferCount)...)

		batch.PutIfNotExists(blockAddressTransferMappingNS, recipientKey, transferHash[:],
			"failed to put transfer hash %x for recipient %x", transfer.Hash(), transfer.Recipient())

		// update recipient transfers count
		recipientTransferCountKey := append(transferToPrefix, transfer.Recipient()...)
		batch.Put(blockAddressTransferCountMappingNS, recipientTransferCountKey,
			byteutil.Uint64ToBytes(recipientTransferCount+1), "failed to bump transfer count %x for recipient %x",
			transfer.Hash(), transfer.Recipient())
	}

	return nil
}
blockchain/blockdao.go:910: 910-967 lines are duplicate of `blockchain/blockdao.go:780-839` (dupl)
func putExecutions(dao *blockDAO, blk *block.Block, batch db.KVStoreBatch) error {
	executorDelta := map[string]uint64{}
	contractDelta := map[string]uint64{}

	_, _, executions := action.ClassifyActions(blk.Actions)
	for _, execution := range executions {
		executionHash := execution.Hash()

		// get execution count for executor
		executorExecutionCount, err := dao.getExecutionCountByExecutorAddress(execution.Executor())
		if err != nil {
			return errors.Wrapf(err, "for executor %x", execution.Executor())
		}
		if delta, ok := executorDelta[execution.Executor()]; ok {
			executorExecutionCount += delta
			executorDelta[execution.Executor()] = executorDelta[execution.Executor()] + 1
		} else {
			executorDelta[execution.Executor()] = 1
		}

		// put new execution to executor
		executorKey := append(executionFromPrefix, execution.Executor()...)
		executorKey = append(executorKey, byteutil.Uint64ToBytes(executorExecutionCount)...)
		batch.PutIfNotExists(blockAddressExecutionMappingNS, executorKey, executionHash[:],
			"failed to put execution hash %x for executor %x", execution.Hash(), execution.Executor())

		// update executor executions count
		executorExecutionCountKey := append(executionFromPrefix, execution.Executor()...)
		batch.Put(blockAddressExecutionCountMappingNS, executorExecutionCountKey,
			byteutil.Uint64ToBytes(executorExecutionCount+1),
			"failed to bump execution count %x for executor %x", execution.Hash(), execution.Executor())

		// get execution count for contract
		contractExecutionCount, err := dao.getExecutionCountByContractAddress(execution.Contract())
		if err != nil {
			return errors.Wrapf(err, "for contract %x", execution.Contract())
		}
		if delta, ok := contractDelta[execution.Contract()]; ok {
			contractExecutionCount += delta
			contractDelta[execution.Contract()] = contractDelta[execution.Contract()] + 1
		} else {
			contractDelta[execution.Contract()] = 1
		}

		// put new execution to contract
		contractKey := append(executionToPrefix, execution.Contract()...)
		contractKey = append(contractKey, byteutil.Uint64ToBytes(contractExecutionCount)...)
		batch.PutIfNotExists(blockAddressExecutionMappingNS, contractKey, executionHash[:],
			"failed to put execution hash %x for contract %x", execution.Hash(), execution.Contract())

		// update contract executions count
		contractExecutionCountKey := append(executionToPrefix, execution.Contract()...)
		batch.Put(blockAddressExecutionCountMappingNS, contractExecutionCountKey,
			byteutil.Uint64ToBytes(contractExecutionCount+1), "failed to bump execution count %x for contract %x",
			execution.Hash(), execution.Contract())
	}
	return nil
}
consensus/scheme/rolldpos/fsm_test.go:122: 122-149 lines are duplicate of `consensus/scheme/rolldpos/fsm_test.go:150-177` (dupl)
	t.Run("calcEpochNumAndHeight-error", func(t *testing.T) {
		ctrl := gomock.NewController(t)
		defer ctrl.Finish()

		delegates := make([]string, 4)
		for i := 0; i < 4; i++ {
			delegates[i] = testAddrs[i].RawAddress
		}
		cfsm := newTestCFSM(
			t,
			testAddrs[0],
			testAddrs[2],
			ctrl,
			delegates,
			func(mockBlockchain *mock_blockchain.MockBlockchain) {
				mockBlockchain.EXPECT().TipHeight().Return(uint64(0)).Times(2)
				mockBlockchain.EXPECT().CandidatesByHeight(gomock.Any()).Return(nil, nil).Times(1)
			},
			nil,
			clock.New(),
		)
		s, err := cfsm.handleRollDelegatesEvt(cfsm.newCEvt(eRollDelegates))
		assert.Equal(t, sEpochStart, s)
		assert.Error(t, err)
		// epoch ctx not set
		assert.Equal(t, uint64(0), cfsm.ctx.epoch.height)
		assert.Equal(t, eRollDelegates, (<-cfsm.evtq).Type())
	})
consensus/scheme/rolldpos/fsm_test.go:150: 150-177 lines are duplicate of `consensus/scheme/rolldpos/fsm_test.go:122-149` (dupl)
	t.Run("rollingDelegates-error", func(t *testing.T) {
		ctrl := gomock.NewController(t)
		defer ctrl.Finish()

		delegates := make([]string, 4)
		for i := 0; i < 4; i++ {
			delegates[i] = testAddrs[i].RawAddress
		}
		cfsm := newTestCFSM(
			t,
			testAddrs[0],
			testAddrs[2],
			ctrl,
			delegates,
			func(mockBlockchain *mock_blockchain.MockBlockchain) {
				mockBlockchain.EXPECT().TipHeight().Return(uint64(1)).Times(2)
				mockBlockchain.EXPECT().CandidatesByHeight(gomock.Any()).Return(nil, nil).Times(1)
			},
			nil,
			clock.New(),
		)
		s, err := cfsm.handleRollDelegatesEvt(cfsm.newCEvt(eRollDelegates))
		assert.Equal(t, sEpochStart, s)
		assert.Error(t, err)
		// epoch ctx not set
		assert.Equal(t, uint64(0), cfsm.ctx.epoch.height)
		assert.Equal(t, eRollDelegates, (<-cfsm.evtq).Type())
	})
blockchain/blockdao_test.go:676: G404: Use of weak random number generator (math/rand instead of crypto/rand) (gosec)
	path := "/tmp/test-kv-store-" + string(rand.Int())
db/rds/rds_test.go:103: G404: Use of weak random number generator (math/rand instead of crypto/rand) (gosec)
	path := "/tmp/test-rds-store-" + strconv.Itoa(rand.Int())
db/rds/rds_test.go:247: G404: Use of weak random number generator (math/rand instead of crypto/rand) (gosec)
	path := "/tmp/test-rds-store-batch-rollback" + strconv.Itoa(rand.Int())
WARN [runner] Panic stack trace: goroutine 7119 [running]:
runtime/debug.Stack(0x1937845, 0x12, 0xc46a602f98)
	/usr/local/Cellar/go@1.10/1.10.7/libexec/src/runtime/debug/stack.go:24 +0xa7
github.com/golangci/golangci-lint/pkg/lint.Runner.runLinterSafe.func1(0xc46a603b00, 0xc460b9b960, 0xe, 0xe, 0x19ece60, 0xc477d4ba40)
	/Users/zjshen/Projects/go/src/github.com/golangci/golangci-lint/pkg/lint/runner.go:87 +0xbc
panic(0x17cea80, 0x1e36830)
	/usr/local/Cellar/go@1.10/1.10.7/libexec/src/runtime/panic.go:502 +0x229
github.com/golangci/golangci-lint/vendor/github.com/golangci/unparam/check.(*Checker).alwaysReceivedConst(0xc4816e5200, 0xc4ac417e00, 0xb, 0x10, 0xc45cba98c0, 0x1, 0x0, 0x0)
	/Users/zjshen/Projects/go/src/github.com/golangci/golangci-lint/vendor/github.com/golangci/unparam/check/check.go:487 +0x4c7
github.com/golangci/golangci-lint/vendor/github.com/golangci/unparam/check.(*Checker).checkFunc(0xc4816e5200, 0xc443b63040, 0xc431207600)
	/Users/zjshen/Projects/go/src/github.com/golangci/golangci-lint/vendor/github.com/golangci/unparam/check/check.go:386 +0xc11
github.com/golangci/golangci-lint/vendor/github.com/golangci/unparam/check.(*Checker).Check(0xc4816e5200, 0xc4816e5200, 0x10, 0xc43cbb8778, 0x10103f8, 0x1866240)
	/Users/zjshen/Projects/go/src/github.com/golangci/golangci-lint/vendor/github.com/golangci/unparam/check/check.go:241 +0x5df
github.com/golangci/golangci-lint/pkg/golinters.Unparam.Run(0x19e77a0, 0xc420230960, 0xc48170f0a0, 0xc4816ffca0, 0x18c605e, 0x7, 0x19ece60, 0xc477d52690)
	/Users/zjshen/Projects/go/src/github.com/golangci/golangci-lint/pkg/golinters/unparam.go:31 +0xeb
github.com/golangci/golangci-lint/pkg/lint.Runner.runLinterSafe(0xc460b9b960, 0xe, 0xe, 0x19ece60, 0xc477d4ba40, 0x19e77a0, 0xc420230960, 0xc4816778f0, 0x19e6a20, 0x1f62b50, ...)
	/Users/zjshen/Projects/go/src/github.com/golangci/golangci-lint/pkg/lint/runner.go:93 +0x1a9
github.com/golangci/golangci-lint/pkg/lint.Runner.runWorker.func1()
	/Users/zjshen/Projects/go/src/github.com/golangci/golangci-lint/pkg/lint/runner.go:127 +0xe3
github.com/golangci/golangci-lint/pkg/timeutils.(*Stopwatch).TrackStage(0xc4816f7c20, 0x18c605e, 0x7, 0xc43cbb8e38)
	/Users/zjshen/Projects/go/src/github.com/golangci/golangci-lint/pkg/timeutils/stopwatch.go:75 +0x53
github.com/golangci/golangci-lint/pkg/lint.Runner.runWorker(0xc460b9b960, 0xe, 0xe, 0x19ece60, 0xc477d4ba40, 0x19e77a0, 0xc420230960, 0xc4816778f0, 0xc4816fd920, 0xc4816fd980, ...)
	/Users/zjshen/Projects/go/src/github.com/golangci/golangci-lint/pkg/lint/runner.go:126 +0x20d
github.com/golangci/golangci-lint/pkg/lint.(*Runner).runWorkers.func1(0xc481700600, 0xc477d52570, 0x19e77a0, 0xc420230960, 0xc4816778f0, 0xc4816fd920, 0xc4816fd980, 0xc481616600, 0x8, 0x8, ...)
	/Users/zjshen/Projects/go/src/github.com/golangci/golangci-lint/pkg/lint/runner.go:181 +0x152
created by github.com/golangci/golangci-lint/pkg/lint.(*Runner).runWorkers
	/Users/zjshen/Projects/go/src/github.com/golangci/golangci-lint/pkg/lint/runner.go:178 +0x1b8
 
WARN [runner] Can't run linter unparam: panic occurred: runtime error: index out of range 
action/action.go:20: File is not `goimports`-ed (goimports)
	"github.com/iotexproject/iotex-core/proto"
action/createdeposit.go:18: File is not `goimports`-ed (goimports)
	"github.com/iotexproject/iotex-core/proto"
action/execution.go:19: File is not `goimports`-ed (goimports)
	"github.com/iotexproject/iotex-core/proto"
indexservice/server_test.go:25:19: do not pass a nil Context, even if a function permits it; pass context.TODO if you are unsure about which Context to use (megacheck)
	err := svr.Start(nil)
	                 ^
indexservice/server_test.go:34:17: do not pass a nil Context, even if a function permits it; pass context.TODO if you are unsure about which Context to use (megacheck)
	err = svr.Stop(nil)
	               ^
state/factory/factory_test.go:1064:28: do not pass a nil Context, even if a function permits it; pass context.TODO if you are unsure about which Context to use (megacheck)
	_, _, err = ws.RunActions(nil, 1, nil)
	                          ^
tools/util/injectorutil.go:101:20: using time.Tick leaks the underlying ticker, consider using it only in endless functions, tests and the main package, and use time.NewTicker here (megacheck)
	reset := time.Tick(time.Duration(resetInterval) * time.Second)
	                  ^
consensus/scheme/rolldpos/rolldpos_test.go:726:55: should use make(map[string]*iotxaddress.Address) instead (megacheck)
		addressMap := make(map[string]*iotxaddress.Address, 0)
		                                                    ^
db/db_badger.go:212:20: func `(*badgerDB).batchPutForceFail` is unused (megacheck)
func (b *badgerDB) batchPutForceFail(namespace string, key [][]byte, value [][]byte) error {
                   ^
{code}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment