loomchain icon indicating copy to clipboard operation
loomchain copied to clipboard

Fix linter errors

Open suhasagg opened this issue 5 years ago • 4 comments

  • [ ] 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

suhasagg avatar Jul 30 '19 03:07 suhasagg

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 avatar Jul 30 '19 11:07 suhasagg

Some discussion in this context - https://github.com/golang/go/issues/13675

suhasagg avatar Jul 30 '19 11:07 suhasagg

integration_tests/ethcoin_evm_test.go:254: G105: Use of math/big.Int.Exp function should be audited for modulus == 0 (gosec) ret.Exp(ret, big.NewInt(n), nil) migrations/migration_test.go:64: G105: Use of math/big.Int.Exp function should be audited for modulus == 0 (gosec) amount.Exp(amount, big.NewInt(19), big.NewInt(0))

Some discussion in this context ==> https://github.com/securego/gosec/issues/283

suhasagg avatar Jul 30 '19 14:07 suhasagg

https://securego.io/docs/rules/g101.html - Generates a false positive,warning can be suppressed cmd/loom/gateway/query_cmds.go:150: G101: Potential hardcoded credentials (gosec)

const queryUnclaimedTokensCmdExample = `
# Show unclaimed LOOM in the DAppChain Gateway deposited by an Ethereum account
./loom gateway unclaimed-tokens loomcoin-gateway 0x2a6b071aD396cEFdd16c731454af0d8c95ECD4B2
# Show unclaimed tokens in the DAppChain Gateway deposited by an Ethereum account
./loom gateway unclaimed-tokens eth:0x5d1ddf5223a412d24901c32d14ef56cb706c0f64
`

suhasagg avatar Jul 31 '19 08:07 suhasagg