Preparing report...

Report for github.com/josetom/go-chain

A+    Excellent!    Found 45 issues across 77 files

Tweet

gofmt100%

Gofmt formats Go programs. We run gofmt -s on your code, where -s is for the "simplify" command

No problems detected. Good job!


go_vet100%

go vet examines Go source code and reports suspicious constructs, such as Printf calls whose arguments do not align with the format string.

No problems detected. Good job!


gocyclo100%

Gocyclo calculates cyclomatic complexities of functions in Go source code. The cyclomatic complexity of a function is calculated according to the following rules: 1 is the base complexity of a function +1 for each 'if', 'for', 'case', '&&' or '||' Go Report Card warns on functions with cyclomatic complexity > 15.

No problems detected. Good job!


golint41%

Golint is a linter for Go source code.

    • go-chain/core/state.go
    • Line 14: warning: exported type State should have comment or be unexported (golint)
    • Line 22: warning: comment on exported function LoadState should be of the form "LoadState ..." (golint)
    • Line 141: warning: exported method State.AddTransaction should have comment or be unexported (golint)
    • Line 149: warning: exported method State.AddBlock should have comment or be unexported (golint)
    • Line 195: warning: exported method State.Close should have comment or be unexported (golint)
    • Line 199: warning: exported method State.LatestBlockHash should have comment or be unexported (golint)
    • Line 203: warning: exported method State.LatestBlock should have comment or be unexported (golint)
    • Line 207: warning: exported method State.NextBlockNumber should have comment or be unexported (golint)
    • Line 211: warning: exported method State.Copy should have comment or be unexported (golint)
    • Line 224: warning: exported method State.GetBlock should have comment or be unexported (golint)
    • Line 239: warning: exported method State.GetBlockWithHashBytes should have comment or be unexported (golint)
    • go-chain/common/signature.go
    • Line 5: warning: exported const SignatureLength should have comment or be unexported (golint)
    • Line 7: warning: exported type Signature should have comment or be unexported (golint)
    • Line 13: warning: exported method Signature.Bytes should have comment or be unexported (golint)
    • Line 17: warning: comment on exported method Signature.MarshalText should be of the form "MarshalText ..." (golint)
    • Line 38: warning: exported method Signature.Equal should have comment or be unexported (golint)
    • Line 38: warning: receiver name a should be consistent with previous receiver name s for Signature (golint)
    • Line 42: warning: exported method Signature.IsEmpty should have comment or be unexported (golint)
    • Line 42: warning: receiver name a should be consistent with previous receiver name s for Signature (golint)
    • go-chain/test_helper/test_helper_core/test_helper_core.go
    • Line 1: warning: don't use an underscore in package name (golint)
    • Line 13: warning: comment on exported function GetTestTxn should be of the form "GetTestTxn ..." (golint)
    • Line 32: warning: exported function GetTestState should have comment or be unexported (golint)
    • Line 45: warning: exported function GetTestBlock should have comment or be unexported (golint)
    • Line 59: warning: if block ends with a return statement, so drop this else and outdent its block (golint)
    • go-chain/common/utils.go
    • Line 11: warning: comment on exported function BytesToHash should be of the form "BytesToHash ..." (golint)
    • Line 17: warning: comment on exported function Hex2Bytes should be of the form "Hex2Bytes ..." (golint)
    • Line 40: warning: exported function Bytes2Hex should have comment or be unexported (golint)
    • Line 48: warning: exported function MarshalUtil should have comment or be unexported (golint)
    • Line 55: warning: comment on exported function UnmarshalUtil should be of the form "UnmarshalUtil ..." (golint)
    • Line 72: warning: exported function DeepCopy should have comment or be unexported (golint)
    • Line 77: warning: exported function GenNonce should have comment or be unexported (golint)
    • go-chain/cmd/go-chain/version.go
    • Line 9: warning: exported const Major should have comment or be unexported (golint)
    • Line 10: warning: exported const Minor should have comment or be unexported (golint)
    • Line 11: warning: exported const Fix should have comment or be unexported (golint)
    • Line 12: warning: exported const Verbal should have comment or be unexported (golint)
    • go-chain/core/config.go
    • Line 3: warning: exported type CoreConfig should have comment or be unexported (golint)
    • Line 8: warning: exported type StateConfig should have comment or be unexported (golint)
    • Line 12: warning: exported type BlockConfig should have comment or be unexported (golint)
    • Line 17: warning: exported var Config should have comment or be unexported (golint)
    • Line 19: warning: exported function SetConfig should have comment or be unexported (golint)
    • go-chain/core/transaction.go
    • Line 12: warning: exported type TransactionData should have comment or be unexported (golint)
    • Line 19: warning: exported type TransactionContent should have comment or be unexported (golint)
    • Line 25: warning: exported type Transaction should have comment or be unexported (golint)
    • Line 31: warning: exported function NewTransaction should have comment or be unexported (golint)
    • Line 46: warning: exported method Transaction.Encode should have comment or be unexported (golint)
    • Line 59: warning: exported method Transaction.Hash should have comment or be unexported (golint)
    • Line 64: warning: exported method Transaction.From should have comment or be unexported (golint)
    • Line 68: warning: exported method Transaction.To should have comment or be unexported (golint)
    • Line 72: warning: exported method Transaction.Value should have comment or be unexported (golint)
    • Line 76: warning: exported method Transaction.Data should have comment or be unexported (golint)
    • Line 80: warning: exported method Transaction.Fee should have comment or be unexported (golint)
    • Line 84: warning: exported method Transaction.Cost should have comment or be unexported (golint)
    • Line 88: warning: exported method Transaction.WithSignature should have comment or be unexported (golint)
    • Line 92: warning: exported method Transaction.IsAuthentic should have comment or be unexported (golint)
    • Line 107: warning: exported method Transaction.Sign should have comment or be unexported (golint)
    • Line 125: warning: if block ends with a return statement, so drop this else and outdent its block (golint)
    • go-chain/node/node.go
    • Line 12: warning: exported type Node should have comment or be unexported (golint)
    • Line 22: warning: exported function NewNode should have comment or be unexported (golint)
    • Line 41: warning: exported method Node.Run should have comment or be unexported (golint)
    • Line 82: warning: exported method Node.AddPeer should have comment or be unexported (golint)
    • Line 86: warning: exported method Node.RemovePeer should have comment or be unexported (golint)
    • Line 90: warning: exported method Node.IsKnownPeer should have comment or be unexported (golint)
    • go-chain/wallet/wallet.go
    • Line 18: warning: exported function GetWalletDir should have comment or be unexported (golint)
    • Line 22: warning: exported function NewKeystoreAccount should have comment or be unexported (golint)
    • Line 31: warning: exported function GetKeyForAddress should have comment or be unexported (golint)
    • Line 48: warning: exported function Sign should have comment or be unexported (golint)
    • Line 59: warning: exported function SignForAddress should have comment or be unexported (golint)
    • Line 67: warning: exported function VerifyAndRecoverAccount should have comment or be unexported (golint)
    • go-chain/common/address.go
    • Line 7: warning: exported const AddressLength should have comment or be unexported (golint)
    • Line 9: warning: exported type Address should have comment or be unexported (golint)
    • Line 11: warning: comment on exported function NewAddress should be of the form "NewAddress ..." (golint)
    • Line 18: warning: exported method Address.Bytes should have comment or be unexported (golint)
    • Line 22: warning: comment on exported function BytesToAddress should be of the form "BytesToAddress ..." (golint)
    • Line 38: warning: exported method Address.Hash should have comment or be unexported (golint)
    • Line 42: warning: exported method Address.Equal should have comment or be unexported (golint)
    • Line 51: warning: comment on exported method Address.MarshalText should be of the form "MarshalText ..." (golint)
    • go-chain/core/genesis.go
    • Line 11: warning: exported type GenesisConfig should have comment or be unexported (golint)
    • Line 15: warning: exported type Genesis should have comment or be unexported (golint)
    • Line 39: warning: exported method Genesis.Hash should have comment or be unexported (golint)
    • go-chain/db/config.go
    • Line 3: warning: exported type DbConfig should have comment or be unexported (golint)
    • Line 7: warning: exported var Config should have comment or be unexported (golint)
    • Line 9: warning: exported function SetConfig should have comment or be unexported (golint)
    • go-chain/test_helper/test_constants.go
    • Line 1: warning: don't use an underscore in package name (golint)
    • Line 6: warning: don't use underscores in Go names; const Address_0_with_0x should be Address0With0x (golint)
    • Line 6: warning: exported const Address_0_with_0x should have comment (or a comment on this block) or be unexported (golint)
    • Line 8: warning: don't use underscores in Go names; const Address_100 should be Address100 (golint)
    • Line 9: warning: don't use underscores in Go names; const Address_200 should be Address200 (golint)
    • Line 11: warning: don't use underscores in Go names; const Address_100_Hex_with_0x should be Address100HexWith0x (golint)
    • Line 12: warning: don't use underscores in Go names; const Address_200_Hex_with_0x should be Address200HexWith0x (golint)
    • Line 14: warning: don't use underscores in Go names; const Address_100_Hex_without_0x should be Address100HexWithout0x (golint)
    • Line 15: warning: don't use underscores in Go names; const Address_200_Hex_without_0x should be Address200HexWithout0x (golint)
    • Line 17: warning: don't use underscores in Go names; const Address_100_with_extra_2_zeroes_prefixed should be Address100WithExtra2ZeroesPrefixed (golint)
    • Line 18: warning: don't use underscores in Go names; const Address_100_with_extra_2_numbers_prefixed should be Address100WithExtra2NumbersPrefixed (golint)
    • Line 20: warning: don't use underscores in Go names; const Test_Address_1 should be TestAddress1 (golint)
    • Line 21: warning: don't use underscores in Go names; const Test_Address_2 should be TestAddress2 (golint)
    • Line 23: warning: don't use underscores in Go names; const Hash_0x should be Hash0x (golint)
    • Line 25: warning: don't use underscores in Go names; const Hash_Block_0 should be HashBlock0 (golint)
    • Line 26: warning: don't use underscores in Go names; const Hash_Block_1 should be HashBlock1 (golint)
    • Line 28: warning: don't use underscores in Go names; const Hash_Txn_100_Reward should be HashTxn100Reward (golint)
    • Line 29: warning: don't use underscores in Go names; const Hash_Block_100_Reward should be HashBlock100Reward (golint)
    • Line 36: warning: don't use underscores in Go names; var Address_100_as_Bytes should be Address100AsBytes (golint)
    • Line 36: warning: exported var Address_100_as_Bytes should have comment or be unexported (golint)
    • Line 37: warning: don't use underscores in Go names; var Address_200_as_Bytes should be Address200AsBytes (golint)
    • Line 37: warning: exported var Address_200_as_Bytes should have comment or be unexported (golint)
    • Line 39: warning: don't use underscores in Go names; var Address_100_Hex_with_0x_as_Bytes should be Address100HexWith0xAsBytes (golint)
    • Line 39: warning: exported var Address_100_Hex_with_0x_as_Bytes should have comment or be unexported (golint)
    • Line 40: warning: don't use underscores in Go names; var Address_100_Hex_without_0x_as_Bytes should be Address100HexWithout0xAsBytes (golint)
    • Line 40: warning: exported var Address_100_Hex_without_0x_as_Bytes should have comment or be unexported (golint)
    • Line 42: warning: don't use underscores in Go names; var Hash_Address_100_as_Bytes should be HashAddress100AsBytes (golint)
    • Line 42: warning: exported var Hash_Address_100_as_Bytes should have comment or be unexported (golint)
    • Line 44: warning: don't use underscores in Go names; var Hash_Address_100_with_0x should be HashAddress100With0x (golint)
    • Line 44: warning: exported var Hash_Address_100_with_0x should have comment or be unexported (golint)
    • Line 45: warning: don't use underscores in Go names; var Hash_Address_100_with_0x_as_Bytes should be HashAddress100With0xAsBytes (golint)
    • Line 45: warning: exported var Hash_Address_100_with_0x_as_Bytes should have comment or be unexported (golint)
    • Line 47: warning: don't use underscores in Go names; var Address_100_with_extra_2_zeroes_prefixed_as_bytes should be Address100WithExtra2ZeroesPrefixedAsBytes (golint)
    • Line 47: warning: exported var Address_100_with_extra_2_zeroes_prefixed_as_bytes should have comment or be unexported (golint)
    • Line 48: warning: don't use underscores in Go names; var Address_100_with_extra_2_numbers_prefixed_as_bytes should be Address100WithExtra2NumbersPrefixedAsBytes (golint)
    • Line 48: warning: exported var Address_100_with_extra_2_numbers_prefixed_as_bytes should have comment or be unexported (golint)
    • go-chain/db/defaults.go
    • Line 4: warning: exported const LEVEL_DB should have comment (or a comment on this block) or be unexported (golint)
    • Line 8: warning: exported function Defaults should have comment or be unexported (golint)
    • go-chain/wallet/config.go
    • Line 3: warning: exported type WalletConfig should have comment or be unexported (golint)
    • Line 7: warning: exported var Config should have comment or be unexported (golint)
    • Line 9: warning: exported function SetConfig should have comment or be unexported (golint)
    • go-chain/core/block.go
    • Line 11: warning: exported type Block should have comment or be unexported (golint)
    • Line 16: warning: exported type BlockHeader should have comment or be unexported (golint)
    • Line 27: warning: exported type BlockFS should have comment or be unexported (golint)
    • Line 32: warning: exported function NewBlock should have comment or be unexported (golint)
    • Line 57: warning: exported method Block.Hash should have comment or be unexported (golint)
    • Line 65: warning: exported method Block.IsEmpty should have comment or be unexported (golint)
    • Line 69: warning: exported method Block.IsBlockHashValid should have comment or be unexported (golint)
    • Line 74: warning: don't use underscores in Go names; var fmt_s should be fmtS (golint)
    • go-chain/core/constants.go
    • Line 3: warning: exported const MINING_ALGO_POW should have comment or be unexported (golint)
    • Line 5: warning: exported const INDEX_BLOCK_HASH should have comment or be unexported (golint)
    • Line 6: warning: exported const INDEX_BLOCK_NUMBER should have comment or be unexported (golint)
    • go-chain/node/config.go
    • Line 5: warning: exported type NodeConfig should have comment or be unexported (golint)
    • Line 13: warning: exported type HttpConfig should have comment or be unexported (golint)
    • Line 19: warning: exported type BootstrapNodeConfig should have comment or be unexported (golint)
    • Line 23: warning: exported type SyncConfig should have comment or be unexported (golint)
    • Line 27: warning: exported type MinerConfig should have comment or be unexported (golint)
    • Line 32: warning: exported var Config should have comment or be unexported (golint)
    • Line 34: warning: exported function SetConfig should have comment or be unexported (golint)
    • go-chain/node/peer.go
    • Line 3: warning: exported type PeerNode should have comment or be unexported (golint)
    • Line 10: warning: exported function NewPeerNode should have comment or be unexported (golint)
    • go-chain/common/hash.go
    • Line 5: warning: exported const HashLength should have comment or be unexported (golint)
    • Line 7: warning: exported type Hash should have comment or be unexported (golint)
    • Line 13: warning: exported method Hash.Bytes should have comment or be unexported (golint)
    • Line 17: warning: comment on exported method Hash.MarshalText should be of the form "MarshalText ..." (golint)
    • Line 38: warning: exported method Hash.Equal should have comment or be unexported (golint)
    • Line 38: warning: receiver name a should be consistent with previous receiver name h for Hash (golint)
    • Line 42: warning: exported method Hash.IsEmpty should have comment or be unexported (golint)
    • Line 42: warning: receiver name a should be consistent with previous receiver name h for Hash (golint)
    • go-chain/fs/utils.go
    • Line 15: warning: comment on exported function ExpandPath should be of the form "ExpandPath ..." (golint)
    • Line 35: warning: exported function DoesExist should have comment or be unexported (golint)
    • Line 43: warning: exported function WriteEmptyBlocksDbToDisk should have comment or be unexported (golint)
    • go-chain/db/filedb/filedb_iterator.go
    • Line 13: warning: exported type FileDbIterator should have comment or be unexported (golint)
    • Line 40: warning: exported method FileDbIterator.Key should have comment or be unexported (golint)
    • Line 44: warning: exported method FileDbIterator.Value should have comment or be unexported (golint)
    • Line 48: warning: exported method FileDbIterator.Next should have comment or be unexported (golint)
    • Line 51: warning: if block ends with a return statement, so drop this else and outdent its block (golint)
    • Line 63: warning: exported method FileDbIterator.Seek should have comment or be unexported (golint)
    • go-chain/test_helper/test_helper.go
    • Line 1: warning: don't use an underscore in package name (golint)
    • Line 10: warning: exported function GetTestDataDir should have comment or be unexported (golint)
    • Line 16: warning: exported function GetTestFile should have comment or be unexported (golint)
    • Line 20: warning: exported function CreateAndGetTestDbFile should have comment or be unexported (golint)
    • Line 26: warning: exported function DeleteTestDbFile should have comment or be unexported (golint)
    • Line 33: warning: exported function CreateAndGetTestWalletDir should have comment or be unexported (golint)
    • Line 38: warning: if block ends with a return statement, so drop this else and outdent its block (golint)
    • Line 43: warning: exported function DeleteTestWalletDir should have comment or be unexported (golint)
    • go-chain/core/fs.go
    • Line 12: warning: exported type FsProvider should have comment or be unexported (golint)
    • Line 19: warning: exported function InitFS should have comment or be unexported (golint)
    • Line 41: warning: exported function GetDataDir should have comment or be unexported (golint)
    • Line 45: warning: exported function GetGenesisFilePath should have comment or be unexported (golint)
    • Line 49: warning: exported function GetBlocksDbPath should have comment or be unexported (golint)
    • go-chain/node/http_routes.go
    • Line 13: warning: exported const RequestBalances should have comment (or a comment on this block) or be unexported (golint)
    • Line 22: warning: exported type HandlerFunc should have comment or be unexported (golint)
    • Line 24: warning: exported type ErrRes should have comment or be unexported (golint)
    • Line 28: warning: exported type BalancesRes should have comment or be unexported (golint)
    • Line 33: warning: exported type NodeStatusRes should have comment or be unexported (golint)
    • Line 41: warning: exported type NodeSyncRes should have comment or be unexported (golint)
    • Line 45: warning: exported type NodeAddPeerReq should have comment or be unexported (golint)
    • Line 50: warning: exported type NodeAddPeerRes should have comment or be unexported (golint)
    • go-chain/node/miner.go
    • Line 17: warning: exported type Miner should have comment or be unexported (golint)
    • Line 30: warning: exported function InitMiner should have comment or be unexported (golint)
    • go-chain/fs/config.go
    • Line 3: warning: exported type FsConfig should have comment or be unexported (golint)
    • Line 7: warning: exported var Config should have comment or be unexported (golint)
    • Line 9: warning: exported function SetConfig should have comment or be unexported (golint)

license100%

Checks whether your project has a LICENSE file.

No problems detected. Good job!


ineffassign100%

IneffAssign detects ineffectual assignments in Go code.

No problems detected. Good job!


misspell100%

Misspell Finds commonly misspelled English words

No problems detected. Good job!