dusk-network / dusk-blockchain

Reference implementation of the DUSK Network node, written in Golang
MIT License
102 stars 47 forks source link

fix lint issues - last chunk & enable lint to break ci build #379

Closed devtomnl closed 4 years ago

devtomnl commented 4 years ago
Linting Dusk ... /opt/gocode/src/github.com/dusk-network/dusk-blockchain/bin/golangci-lint \
run \
--config \
.golangci.yml
pkg/p2p/kadcast/packet.go:172:20: func `(*Packet).decreaseChunksHeight` is unused (unused)
pkg/rpc/example_test.go:115:6: type `basicAuth` is unused (unused)
pkg/p2p/wire/message/message.go:78:18: func `(*simple).setPayload` is unused (unused)
pkg/core/consensus/generation/generator.go:14:5: var `emptyHash` is unused (unused)
pkg/core/consensus/generation/generator.go:17:5: var `emptyPayload` is unused (unused)
pkg/core/consensus/generation/generator.go:20:5: var `genMessage` is unused (unused)
pkg/core/consensus/selection/selector.go:178:20: func `(*Selector).repropagate` is unused (unused)
pkg/core/consensus/round.go:168:2: field `components` is unused (unused)
pkg/core/chain/chain.go:515:17: func `(*Chain).marshalProvisioners` is unused (unused)
pkg/core/chain/chain.go:179:17: func `(*Chain).propagateBlock` is unused (unused)
pkg/util/diagnostics/profileset.go:34:22: func `(*ProfileSet).drop` is unused (unused)
pkg/p2p/peer/responding/candidatebroker.go:12:6: exported type `CandidateBroker` should have comment or be unexported (golint)
type CandidateBroker struct {
     ^
pkg/p2p/peer/responding/candidatebroker.go:17:1: exported function `NewCandidateBroker` should have comment or be unexported (golint)
func NewCandidateBroker(rpcBus *rpcbus.RPCBus, responseChan chan<- *bytes.Buffer) *CandidateBroker {
^
pkg/p2p/peer/responding/candidatebroker.go:21:1: exported method `CandidateBroker.ProvideCandidate` should have comment or be unexported (golint)
func (c *CandidateBroker) ProvideCandidate(m *bytes.Buffer) error {
^
pkg/p2p/peer/responding/databroker.go:95:1: exported method `DataBroker.SendTxsItems` should have comment or be unexported (golint)
func (d *DataBroker) SendTxsItems() error {
^
pkg/p2p/peer/responding/datarequestor.go:33:1: comment on exported method `DataRequestor.RequestMissingItems` should be of the form `RequestMissingItems ...` (golint)
// AskForMissingItems takes an inventory message, checks it for any items that the node
^
pkg/p2p/peer/responding/roundresultbroker.go:11:6: exported type `RoundResultBroker` should have comment or be unexported (golint)
type RoundResultBroker struct {
     ^
pkg/p2p/peer/responding/roundresultbroker.go:16:1: exported function `NewRoundResultBroker` should have comment or be unexported (golint)
func NewRoundResultBroker(rpcBus *rpcbus.RPCBus, responseChan chan<- *bytes.Buffer) *RoundResultBroker {
^
pkg/p2p/peer/responding/roundresultbroker.go:20:1: exported method `RoundResultBroker.ProvideRoundResult` should have comment or be unexported (golint)
func (r *RoundResultBroker) ProvideRoundResult(m *bytes.Buffer) error {
^
pkg/p2p/peer/responding/candidatebroker.go:22:50: composites: `github.com/dusk-network/dusk-blockchain/pkg/util/nativeutils/rpcbus.Request` composite literal uses unkeyed fields (govet)
        resp, err := c.rpcBus.Call(topics.GetCandidate, rpcbus.Request{*m, make(chan rpcbus.Response, 1)}, 5*time.Second)
                                                        ^
pkg/p2p/peer/responding/roundresultbroker.go:21:53: composites: `github.com/dusk-network/dusk-blockchain/pkg/util/nativeutils/rpcbus.Request` composite literal uses unkeyed fields (govet)
        resp, err := r.rpcBus.Call(topics.GetRoundResults, rpcbus.Request{*m, make(chan rpcbus.Response, 1)}, 5*time.Second)
                                                           ^
pkg/p2p/peer/responding/blockhashbroker.go:50:3: shadow: declaration of "err" shadows declaration at line 38 (govet)
                err := b.db.View(func(t database.Transaction) error {
                ^
pkg/core/transactor/listener.go:163:25: Error return value of `t.w.UpdateWalletHeight` is not checked (errcheck)
                t.w.UpdateWalletHeight(0)
                                      ^
pkg/core/transactor/utils.go:46:9: Error return value of `db.View` is not checked (errcheck)
        db.View(func(t database.Transaction) error {
               ^
pkg/core/transactor/commands.go:72:25: error strings should not be capitalized or end with punctuation or a newline (golint)
                return "", fmt.Errorf("error attempting to decode seed: %v\n", err)
                                      ^
pkg/core/transactor/commands.go:98:1: exported method `Transactor.CreateStandardTx` should have comment or be unexported (golint)
func (t *Transactor) CreateStandardTx(amount uint64, address string) (transactions.Transaction, error) {
^
pkg/core/transactor/commands.go:125:1: exported method `Transactor.CreateStakeTx` should have comment or be unexported (golint)
func (t *Transactor) CreateStakeTx(amount, lockTime uint64) (transactions.Transaction, error) {
^
pkg/core/transactor/commands.go:146:1: exported method `Transactor.CreateBidTx` should have comment or be unexported (golint)
func (t *Transactor) CreateBidTx(amount, lockTime uint64) (transactions.Transaction, error) {
^
pkg/core/transactor/commands.go:184:22: error strings should not be capitalized or end with punctuation or a newline (golint)
                        return fmt.Errorf("error fetching block from node db: %v\n", err)
                                          ^
pkg/core/transactor/commands.go:190:22: error strings should not be capitalized or end with punctuation or a newline (golint)
                        return fmt.Errorf("error checking block: %v\n", err)
                                          ^
pkg/core/transactor/commands.go:220:1: exported method `Transactor.Address` should have comment or be unexported (golint)
func (t *Transactor) Address() (string, error) {
^
pkg/core/transactor/listener.go:33:1: exported method `Transactor.Listen` should have comment or be unexported (golint)
func (t *Transactor) Listen() {
^
pkg/core/transactor/listener.go:353:26: error strings should not be capitalized or end with punctuation or a newline (golint)
                return nil, fmt.Errorf("error encoding transaction: %v\n", err)
                                       ^
pkg/core/transactor/transactor.go:20:1: comment on exported type Transactor should be of the form "Transactor ..." (with optional leading article) (golint)
// TODO: rename
^
pkg/core/transactor/transactor.go:51:1: comment on exported function `New` should be of the form `New ...` (golint)
// Instantiate a new Transactor struct.
^
pkg/core/transactor/transactor.go:155:1: exported method `Transactor.Wallet` should have comment or be unexported (golint)
func (t *Transactor) Wallet() (*wallet.Wallet, error) {
^
pkg/core/transactor/listener.go:82:17: composites: `github.com/dusk-network/dusk-blockchain/pkg/util/nativeutils/rpcbus.Response` composite literal uses unkeyed fields (govet)
                r.RespChan <- rpcbus.Response{bytes.Buffer{}, err}
                              ^
pkg/core/transactor/listener.go:87:16: composites: `github.com/dusk-network/dusk-blockchain/pkg/util/nativeutils/rpcbus.Response` composite literal uses unkeyed fields (govet)
        r.RespChan <- rpcbus.Response{bytes.Buffer{}, nil}
                      ^
pkg/core/transactor/listener.go:104:16: composites: `github.com/dusk-network/dusk-blockchain/pkg/util/nativeutils/rpcbus.Response` composite literal uses unkeyed fields (govet)
        r.RespChan <- rpcbus.Response{loadResponse([]byte(pubKey)), nil}
                      ^
pkg/core/transactor/listener.go:120:16: composites: `github.com/dusk-network/dusk-blockchain/pkg/util/nativeutils/rpcbus.Response` composite literal uses unkeyed fields (govet)
        r.RespChan <- rpcbus.Response{resp, nil}
                      ^
pkg/core/transactor/listener.go:146:16: composites: `github.com/dusk-network/dusk-blockchain/pkg/util/nativeutils/rpcbus.Response` composite literal uses unkeyed fields (govet)
        r.RespChan <- rpcbus.Response{resp, nil}
                      ^
pkg/core/transactor/listener.go:173:16: composites: `github.com/dusk-network/dusk-blockchain/pkg/util/nativeutils/rpcbus.Response` composite literal uses unkeyed fields (govet)
        r.RespChan <- rpcbus.Response{resp, nil}
                      ^
pkg/core/transactor/listener.go:191:16: composites: `github.com/dusk-network/dusk-blockchain/pkg/util/nativeutils/rpcbus.Response` composite literal uses unkeyed fields (govet)
        r.RespChan <- rpcbus.Response{&node.LoadResponse{Key: &node.PubKey{PublicKey: []byte(pubKey)}}, nil}
                      ^
pkg/core/transactor/listener.go:221:16: composites: `github.com/dusk-network/dusk-blockchain/pkg/util/nativeutils/rpcbus.Response` composite literal uses unkeyed fields (govet)
        r.RespChan <- rpcbus.Response{&node.TransferResponse{Hash: txid}, nil}
                      ^
pkg/core/transactor/listener.go:246:16: composites: `github.com/dusk-network/dusk-blockchain/pkg/util/nativeutils/rpcbus.Response` composite literal uses unkeyed fields (govet)
        r.RespChan <- rpcbus.Response{&node.TransferResponse{Hash: txid}, nil}
                      ^
pkg/core/transactor/listener.go:272:16: composites: `github.com/dusk-network/dusk-blockchain/pkg/util/nativeutils/rpcbus.Response` composite literal uses unkeyed fields (govet)
        r.RespChan <- rpcbus.Response{&node.TransferResponse{Hash: txid}, nil}
                      ^
pkg/core/transactor/listener.go:290:16: composites: `github.com/dusk-network/dusk-blockchain/pkg/util/nativeutils/rpcbus.Response` composite literal uses unkeyed fields (govet)
        r.RespChan <- rpcbus.Response{&node.BalanceResponse{UnlockedBalance: unlockedBalance, LockedBalance: lockedBalance}, nil}
                      ^
pkg/core/transactor/listener.go:300:47: composites: `github.com/dusk-network/dusk-blockchain/pkg/util/nativeutils/rpcbus.Request` composite literal uses unkeyed fields (govet)
        resp, err := t.rb.Call(topics.GetMempoolTxs, rpcbus.Request{bytes.Buffer{}, make(chan rpcbus.Response, 1)}, 2*time.Second)
                                                     ^
pkg/core/transactor/listener.go:313:16: composites: `github.com/dusk-network/dusk-blockchain/pkg/util/nativeutils/rpcbus.Response` composite literal uses unkeyed fields (govet)
        r.RespChan <- rpcbus.Response{&node.BalanceResponse{UnlockedBalance: unconfirmedBalance}, nil}
                      ^
pkg/core/transactor/listener.go:322:16: composites: `github.com/dusk-network/dusk-blockchain/pkg/util/nativeutils/rpcbus.Response` composite literal uses unkeyed fields (govet)
        r.RespChan <- rpcbus.Response{&node.GenericResponse{Response: "Consensus transactions are now being automated."}, nil}
                      ^
pkg/core/transactor/listener.go:332:17: composites: `github.com/dusk-network/dusk-blockchain/pkg/util/nativeutils/rpcbus.Response` composite literal uses unkeyed fields (govet)
                r.RespChan <- rpcbus.Response{&node.GenericResponse{Response: "Wallet database deleted."}, nil}
                              ^
pkg/core/transactor/listener.go:340:16: composites: `github.com/dusk-network/dusk-blockchain/pkg/util/nativeutils/rpcbus.Response` composite literal uses unkeyed fields (govet)
        r.RespChan <- rpcbus.Response{&node.GenericResponse{Response: "Wallet database deleted."}, nil}
                      ^
pkg/core/transactor/listener.go:345:16: composites: `github.com/dusk-network/dusk-blockchain/pkg/util/nativeutils/rpcbus.Response` composite literal uses unkeyed fields (govet)
        r.RespChan <- rpcbus.Response{&node.WalletStatusResponse{Loaded: t.w != nil}, nil}
                      ^
pkg/core/transactor/listener.go:356:43: composites: `github.com/dusk-network/dusk-blockchain/pkg/util/nativeutils/rpcbus.Request` composite literal uses unkeyed fields (govet)
        _, err = t.rb.Call(topics.SendMempoolTx, rpcbus.Request{tx, make(chan rpcbus.Response, 1)}, 0)
                                                 ^
pkg/core/transactor/commands.go:112:5: shadow: declaration of "err" shadows declaration at line 102 (govet)
        if err := tx.AddOutput(key.PublicAddress(address), amountScalar); err != nil {
           ^
pkg/eventmon/monitor/monitor_test.go:278:3: SA2000: should call wg.Add(1) before starting the goroutine to avoid a race (staticcheck)
                wg.Add(1)
                ^
pkg/core/database/testing/drivers_test.go:582:54: unnecessary conversion (unconvert)
                        headerHash, err := t.FetchBlockHashByHeight(uint64(block.Header.Height))
                                                                          ^
pkg/core/database/testing/drivers_test.go:156:4: shadow: declaration of "err" shadows declaration at line 148 (govet)
                        err := t.StoreBlock(block)
                        ^
pkg/core/database/testing/drivers_test.go:175:6: shadow: declaration of "err" shadows declaration at line 148 (govet)
                s, err := t.FetchState()
                   ^
pkg/core/database/testing/drivers_test.go:567:4: shadow: declaration of "err" shadows declaration at line 530 (govet)
                        err := t.StoreBlock(b)
                        ^
pkg/core/database/testing/drivers_test.go:599:4: shadow: declaration of "err" shadows declaration at line 530 (govet)
                        err := t.StoreBlock(block)
                        ^
pkg/core/database/testing/drivers_test.go:713:9: shadow: declaration of "err" shadows declaration at line 702 (govet)
                        blk, err := t.FetchBlock(block.Header.Hash)
                             ^
pkg/core/database/testing/drivers_test.go:936:17: shadow: declaration of "err" shadows declaration at line 921 (govet)
                                headerHash, err := t.FetchBlockHashByHeight(block.Header.Height)
                                            ^
pkg/core/consensus/user/bidlist.go:89:1: exported method `BidList.Remove` should have comment or be unexported (golint)
func (b *BidList) Remove(idx int) {
^
pkg/core/consensus/user/bidlist.go:99:1: exported function `MarshalBidList` should have comment or be unexported (golint)
func MarshalBidList(r *bytes.Buffer, bidList BidList) error {
^
pkg/core/consensus/user/bidlist.go:129:1: exported function `UnmarshalBidList` should have comment or be unexported (golint)
func UnmarshalBidList(r *bytes.Buffer) (BidList, error) {
^
pkg/core/consensus/user/provisioners.go:27:2: exported type `Stake` should have comment or be unexported (golint)
        Stake struct {
        ^
pkg/core/consensus/user/provisioners.go:34:1: exported method `Member.AddStake` should have comment or be unexported (golint)
func (m *Member) AddStake(stake Stake) {
^
pkg/core/consensus/user/provisioners.go:38:1: exported method `Member.RemoveStake` should have comment or be unexported (golint)
func (m *Member) RemoveStake(idx int) {
^
pkg/core/consensus/user/provisioners.go:43:1: exported method `Member.SubtractFromStake` should have comment or be unexported (golint)
func (m *Member) SubtractFromStake(amount uint64) uint64 {
^
pkg/core/consensus/user/provisioners.go:50:11: `if` block ends with a `return` statement, so drop this `else` and outdent its block (golint)
                        } else {
                               ^
pkg/core/consensus/user/provisioners.go:60:1: exported function `NewProvisioners` should have comment or be unexported (golint)
func NewProvisioners() *Provisioners {
^
pkg/core/consensus/user/provisioners.go:123:1: exported method `Provisioners.TotalWeight` should have comment or be unexported (golint)
func (p *Provisioners) TotalWeight() (totalWeight uint64) {
^
pkg/core/consensus/user/provisioners.go:133:1: exported function `MarshalProvisioners` should have comment or be unexported (golint)
func MarshalProvisioners(r *bytes.Buffer, p *Provisioners) error {
^
pkg/core/consensus/user/provisioners.go:185:1: exported function `UnmarshalProvisioners` should have comment or be unexported (golint)
func UnmarshalProvisioners(r *bytes.Buffer) (Provisioners, error) {
^
pkg/core/consensus/user/sortition.go:189:3: S1011: should replace loop with `member.Stakes = append(member.Stakes, v.Stakes...)` (gosimple)
                for _, stake := range v.Stakes {
                ^
pkg/core/consensus/user/provisioners.go:109:7: SA6001: m[string(key)] would be more efficient than k := string(key); m[k] (staticcheck)
        i := string(pubKeyBLS)
             ^
pkg/core/consensus/user/sortition.go:34:9: SA5007: infinite recursive call (staticcheck)
        return v.Remove(pk)
               ^
pkg/core/consensus/user/bidlist.go:34:2: shadow: declaration of "BidList" shadows declaration at line 24 (govet)
        BidList := make(BidList, numBids)
        ^
pkg/eventmon/logger/logger.go:28:67: `preferrably` is a misspelling of `preferably` (misspell)
// It creates a new instance of logrus and writes on a io.Writer (preferrably UNIX sockets but any kind of connection will do)
                                                                  ^
pkg/eventmon/logger/round.go:11:1: exported method `LogProcessor.PublishBlockEvent` should have comment or be unexported (golint)
func (l *LogProcessor) PublishBlockEvent(blk *block.Block) {
^
pkg/eventmon/logger/round.go:20:1: exported method `LogProcessor.WithBlock` should have comment or be unexported (golint)
func (l *LogProcessor) WithBlock(blk *block.Block) *log.Entry {
^
pkg/rpc/server.go:29:6: exported type `RPCSrvWrapper` should have comment or be unexported (golint)
type RPCSrvWrapper struct {
     ^
pkg/rpc/server.go:33:1: exported method `RPCSrvWrapper.Shutdown` should have comment or be unexported (golint)
func (r *RPCSrvWrapper) Shutdown() {
^
pkg/core/candidate/broker.go:171:1: exported method `Broker.Validate` should have comment or be unexported (golint)
func (b *Broker) Validate(m message.Message) error {
^
pkg/core/candidate/broker.go:183:1: exported method `Broker.AddValidHash` should have comment or be unexported (golint)
func (b *Broker) AddValidHash(m message.Message) error {
^
pkg/core/candidate/validator.go:12:1: comment on exported function `Validate` should be of the form `Validate ...` (golint)
// Make sure the hash and root are correct, to avoid malicious nodes from
^
pkg/core/candidate/validator.go:19:1: exported function `ValidateCandidate` should have comment or be unexported (golint)
func ValidateCandidate(cm message.Candidate) error {
^
pkg/core/candidate/broker.go:98:35: unnecessary conversion (unconvert)
                if _, ok := b.validHashes[string(k)]; ok {
                                                ^
pkg/core/candidate/broker.go:114:17: composites: `github.com/dusk-network/dusk-blockchain/pkg/util/nativeutils/rpcbus.Response` composite literal uses unkeyed fields (govet)
                r.RespChan <- rpcbus.Response{cm, nil}
                              ^
pkg/core/candidate/broker.go:124:18: composites: `github.com/dusk-network/dusk-blockchain/pkg/util/nativeutils/rpcbus.Response` composite literal uses unkeyed fields (govet)
                        r.RespChan <- rpcbus.Response{nil, err}
                                      ^
pkg/core/candidate/broker.go:129:16: composites: `github.com/dusk-network/dusk-blockchain/pkg/util/nativeutils/rpcbus.Response` composite literal uses unkeyed fields (govet)
        r.RespChan <- rpcbus.Response{cm, nil}
                      ^
pkg/core/candidate/store_test.go:57:46: composites: `github.com/dusk-network/dusk-blockchain/pkg/util/nativeutils/rpcbus.Request` composite literal uses unkeyed fields (govet)
                resp, err := rpc.Call(topics.GetCandidate, rpcbus.Request{*bytes.NewBuffer(genesis.Header.Hash), make(chan rpcbus.Response, 1)}, 0)
                                                           ^
pkg/core/candidate/store_test.go:75:13: SA4017: Errorf is a pure function but its return value is ignored (staticcheck)
                                                err = fmt.Errorf("Candidate Block Tx #%d is different from genesis block Tx", i)
                                                      ^
pkg/core/candidate/broker.go:111:20: S1030: should use params.String() instead of string(params.Bytes()) (gosimple)
        cm, ok := b.queue[string(params.Bytes())]
                          ^
pkg/util/nativeutils/sortedset/cluster.go:32:1: comment on exported method `Cluster.TotalOccurrences` should be of the form `TotalOccurrences ...` (golint)
// Size returns the amount of elements in the cluster
^
pkg/util/nativeutils/sortedset/cluster.go:110:1: exported method `Cluster.IntersectCluster` should have comment or be unexported (golint)
func (c *Cluster) IntersectCluster(committeeSet uint64) Cluster {
^
pkg/util/nativeutils/sortedset/sortedset.go:11:7: exported const `All` should have comment or be unexported (golint)
const All uint64 = math.MaxUint64
      ^
pkg/util/nativeutils/sortedset/sortedset.go:13:6: exported type `Set` should have comment or be unexported (golint)
type Set []*big.Int
     ^
pkg/util/nativeutils/sortedset/sortedset.go:19:1: exported function `New` should have comment or be unexported (golint)
func New() Set {
^
pkg/util/nativeutils/sortedset/sortedset.go:23:1: exported method `Set.Equal` should have comment or be unexported (golint)
func (v Set) Equal(other Set) bool {
^
pkg/util/nativeutils/sortedset/sortedset.go:148:1: exported method `Set.Whole` should have comment or be unexported (golint)
func (v Set) Whole() uint64 {
^
pkg/core/database/lite/database.go:32:6: exported type `DB` should have comment or be unexported (golint)
type DB struct {
     ^
pkg/core/database/lite/database.go:39:1: comment on exported function `NewDatabase` should be of the form `NewDatabase ...` (golint)
// This should be the ideal situation with lowest latency on storing or fetching data
^
pkg/core/database/lite/database.go:70:1: exported method `DB.Update` should have comment or be unexported (golint)
func (db *DB) Update(fn func(database.Transaction) error) error {
^
pkg/core/database/lite/transactions.go:361:25: unnecessary conversion (unconvert)
                height := tip - uint64(n) + uint64(pos)
                                      ^
pkg/core/database/lite/transactions.go:379:21: unnecessary conversion (unconvert)
        return tip - uint64(n) + uint64(pos), nil
                           ^
pkg/core/database/lite/driver.go:30:2: shadow: declaration of "driver" shadows declaration at line 14 (govet)
        driver := driver{}
        ^
pkg/core/database/lite/transactions.go:362:9: shadow: declaration of "err" shadows declaration at line 353 (govet)
                hash, err := t.FetchBlockHashByHeight(height)
                      ^
pkg/core/consensus/candidate/blockgenerator.go:237:14: Error return value of `tx.AddReward` is not checked (errcheck)
        tx.AddReward(*rewardReceiver, reward)
                    ^
pkg/core/consensus/candidate/testutil.go:98:17: Error return value of `rpcBus.Register` is not checked (errcheck)
        rpcBus.Register(topics.GetLastCertificate, c)
                       ^
pkg/core/consensus/candidate/testutil.go:104:29: Error return value of `message.MarshalCertificate` is not checked (errcheck)
                message.MarshalCertificate(buf, cert)
                                          ^
pkg/core/consensus/candidate/testutil.go:112:21: Error return value of `h.Generator.Collect` is not checked (errcheck)
        h.Generator.Collect(sev)
                           ^
pkg/core/consensus/candidate/testutil.go:119:17: Error return value of `h.RBus.Register` is not checked (errcheck)
        h.RBus.Register(topics.GetMempoolTxsBySize, reqChan)
                       ^
pkg/core/consensus/candidate/testutil.go:105:17: composites: `github.com/dusk-network/dusk-blockchain/pkg/util/nativeutils/rpcbus.Response` composite literal uses unkeyed fields (govet)
                r.RespChan <- rpcbus.Response{*buf, nil}
                              ^
pkg/core/consensus/candidate/testutil.go:126:17: composites: `github.com/dusk-network/dusk-blockchain/pkg/util/nativeutils/rpcbus.Response` composite literal uses unkeyed fields (govet)
                r.RespChan <- rpcbus.Response{txs, nil}
                              ^
pkg/core/consensus/candidate/blockgenerator.go:110:5: shadow: declaration of "err" shadows declaration at line 101 (govet)
        if err := bg.signer.Gossip(msg, bg.ID()); err != nil {
           ^
pkg/core/consensus/candidate/genesis_test.go:51:2: unreachable: unreachable code (govet)
        blob, err := hex.DecodeString(cfg.TestNetGenesisBlob)
        ^
pkg/core/consensus/reduction/secondstep/reducer.go:163:25: Error return value of `r.signer.SendInternally` is not checked (errcheck)
        r.signer.SendInternally(topics.Restart, msg, r.ID())
                               ^
pkg/core/consensus/reduction/secondstep/reducer.go:182:18: Error return value of `r.sendReduction` is not checked (errcheck)
                r.sendReduction(step, hdr.BlockHash)
                               ^
pkg/core/consensus/reduction/secondstep/testutil.go:46:41: Error return value of `(*github.com/dusk-network/dusk-blockchain/pkg/core/consensus/reduction/secondstep.Reducer).CollectStepVotes` is not checked (errcheck)
        hlp.Reducer.(*Reducer).CollectStepVotes(msg)
                                               ^
pkg/core/consensus/reduction/secondstep/reducer.go:204:25: `marshalled` is a misspelling of `marshaled` (misspell)
        // then we forward the marshalled Agreement to the store to be sent
                               ^
pkg/p2p/wire/message/transactions.go:99:40: unnecessary conversion (unconvert)
        if err := encoding.WriteUint8(w, uint8(s.Version)); err != nil {
                                              ^
pkg/p2p/wire/message/agreement.go:311:5: shadow: declaration of "err" shadows declaration at line 304 (govet)
        if err := encoding.ReadUint64LE(r, &sv.BitSet); err != nil {
           ^
pkg/p2p/wire/message/agreement.go:317:5: shadow: declaration of "err" shadows declaration at line 304 (govet)
        if err := encoding.ReadBLS(r, signature); err != nil {
           ^
pkg/p2p/wire/message/transactions.go:245:6: shadow: declaration of "err" shadows declaration at line 231 (govet)
                if err := UnmarshalInput(w, s.Inputs[i]); err != nil {
                   ^
pkg/p2p/wire/message/message.go:190:9: S1034: assigning the result of this type assertion to a variable (switch payload := payload.(type)) could eliminate type assertions in switch cases (gosimple)
        switch payload.(type) {
               ^
pkg/core/database/utils/search.go:10:14: unnecessary conversion (unconvert)
                h := uint64(i+j) >> 1 // avoid overflow when computing h
                           ^
pkg/core/database/utils/encoding.go:69:5: shadow: declaration of "err" shadows declaration at line 54 (govet)
        if err := ReadUint32(reader, &txIndex); err != nil {
           ^
pkg/core/chain/chain.go:104:17: Error return value of `rpcBus.Register` is not checked (errcheck)
        rpcBus.Register(topics.GetLastBlock, getLastBlockChan)
                       ^
pkg/core/chain/chain.go:105:17: Error return value of `rpcBus.Register` is not checked (errcheck)
        rpcBus.Register(topics.VerifyCandidateBlock, verifyCandidateBlockChan)
                       ^
pkg/core/chain/chain.go:106:17: Error return value of `rpcBus.Register` is not checked (errcheck)
        rpcBus.Register(topics.GetLastCertificate, getLastCertificateChan)
                       ^
pkg/core/chain/chain.go:107:17: Error return value of `rpcBus.Register` is not checked (errcheck)
        rpcBus.Register(topics.GetRoundResults, getRoundResultsChan)
                       ^
pkg/core/chain/chain.go:108:17: Error return value of `rpcBus.Register` is not checked (errcheck)
        rpcBus.Register(topics.GetSyncProgress, getSyncProgressChan)
                       ^
pkg/core/chain/chain.go:109:17: Error return value of `rpcBus.Register` is not checked (errcheck)
        rpcBus.Register(topics.RebuildChain, rebuildChainChan)
                       ^
pkg/core/chain/chain.go:441:22: Error return value of `c.addProvisioner` is not checked (errcheck)
                                        c.addProvisioner(t.PubKeyEd, t.PubKeyBLS, amount, searchingHeight+2, searchingHeight+t.Lock)
                                                        ^
pkg/core/chain/chain.go:767:14: Error return value of `tx.AddReward` is not checked (errcheck)
        tx.AddReward(*keyPair.PublicKey(), reward)
                    ^
pkg/core/chain/chain.go:372:17: composites: `github.com/dusk-network/dusk-blockchain/pkg/util/nativeutils/rpcbus.Response` composite literal uses unkeyed fields (govet)
                r.RespChan <- rpcbus.Response{nil, errors.New("no intermediate block hash known")}
                              ^
pkg/core/chain/chain.go:378:16: composites: `github.com/dusk-network/dusk-blockchain/pkg/util/nativeutils/rpcbus.Response` composite literal uses unkeyed fields (govet)
        r.RespChan <- rpcbus.Response{nil, err}
                      ^
pkg/core/chain/chain.go:487:11: composites: `github.com/dusk-network/dusk-blockchain/pkg/core/consensus/user.Stake` composite literal uses unkeyed fields (govet)
        stake := user.Stake{amount, startHeight, endHeight}
                 ^
pkg/core/chain/chain.go:571:50: composites: `github.com/dusk-network/dusk-blockchain/pkg/util/nativeutils/rpcbus.Request` composite literal uses unkeyed fields (govet)
        resp, err := c.rpcBus.Call(topics.GetCandidate, rpcbus.Request{*bytes.NewBuffer(cMsg.hash), make(chan rpcbus.Response, 1)}, 5*time.Second)
                                                        ^
pkg/core/chain/chain.go:660:16: composites: `github.com/dusk-network/dusk-blockchain/pkg/util/nativeutils/rpcbus.Response` composite literal uses unkeyed fields (govet)
        r.RespChan <- rpcbus.Response{prevBlock, nil}
                      ^
pkg/core/chain/chain.go:665:17: composites: `github.com/dusk-network/dusk-blockchain/pkg/util/nativeutils/rpcbus.Response` composite literal uses unkeyed fields (govet)
                r.RespChan <- rpcbus.Response{bytes.Buffer{}, errors.New("no last certificate present")}
                              ^
pkg/core/chain/chain.go:671:16: composites: `github.com/dusk-network/dusk-blockchain/pkg/util/nativeutils/rpcbus.Response` composite literal uses unkeyed fields (govet)
        r.RespChan <- rpcbus.Response{*buf, err}
                      ^
pkg/core/chain/chain_test.go:57:2: SA2002: the goroutine calls T.Fatal, which must be called in the same goroutine as the test (staticcheck)
        go func() {
        ^
pkg/core/chain/chain.go:455:2: S1023: redundant `return` statement (gosimple)
        return
        ^
pkg/core/consensus/reduction/firststep/testutil.go:86:19: Error return value of `hlp.RBus.Register` is not checked (errcheck)
        hlp.RBus.Register(topics.VerifyCandidateBlock, v)
                         ^
pkg/core/consensus/reduction/firststep/testutil.go:108:41: Error return value of `(*github.com/dusk-network/dusk-blockchain/pkg/core/consensus/reduction/firststep.Reducer).CollectBestScore` is not checked (errcheck)
        hlp.Reducer.(*Reducer).CollectBestScore(hdr)
                                               ^
pkg/p2p/peer/handshake_test.go:25:2: SA2002: the goroutine calls T.Fatal, which must be called in the same goroutine as the test (staticcheck)
        go func() {
        ^
pkg/p2p/peer/peer_test.go:52:2: SA2002: the goroutine calls T.Fatal, which must be called in the same goroutine as the test (staticcheck)
        go func() {
        ^
cmd/dusk/action.go:93:11: `neighbours` is a misspelling of `neighbors` (misspell)
        // fetch neighbours addresses from the Seeder
                 ^
cmd/dusk/main.go:46:45: S1039: unnecessary use of fmt.Sprintf (gosimple)
                log.WithError(fmt.Errorf("%+v", r)).Error(fmt.Sprintf("Application panic"))
                                                          ^
pkg/core/consensus/selection/testutil.go:34:83: `Marshalling` is a misspelling of `Marshaling` (misspell)
        // TODO: interface - setting the payload to a buffer will go away as soon as the Marshalling
                                                                                         ^
pkg/util/nativeutils/eventbus/listenermap.go:38:2: S1005: unnecessary assignment to the blank identifier (gosimple)
        listeners, _ := h.listeners[key]
        ^
pkg/util/stringify.go:11:5: S1009: should omit nil check; len() for nil slices is defined as zero (gosimple)
        if b != nil && len(b) > 0 {
           ^
pkg/p2p/kadcast/network.go:100:12: Error return value of `pc.Close` is not checked (errcheck)
                        pc.Close()
                                ^
pkg/p2p/kadcast/packet_processor.go:95:4: ineffectual assignment to `err` (ineffassign)
                        err = verifyIDNonce(senderID, nonce)
                        ^
pkg/p2p/kadcast/bucket.go:87:6: S1002: should omit comparison to bool constant, can be simplified to `!b.lruPresent[peer]` (gosimple)
                if b.lruPresent[peer] == false {
                   ^
pkg/p2p/kadcast/bucket.go:102:5: S1002: should omit comparison to bool constant, can be simplified to `!b.lruPresent[peer]` (gosimple)
        if b.lruPresent[peer] == false {
           ^
pkg/p2p/kadcast/packet.go:244:5: S1002: should omit comparison to bool constant, can be simplified to `chunkMap[*chunkID]` (gosimple)
        if chunkMap[*chunkID] == true {
           ^
pkg/core/consensus/queue.go:48:5: `Initialise` is a misspelling of `Initialize` (misspell)
        // Initialise the array on this step if it was not yet created
           ^
pkg/core/consensus/round.go:422:83: `Marshalling` is a misspelling of `Marshaling` (misspell)
        // TODO: interface - setting the payload to a buffer will go away as soon as the Marshalling
                                                                                         ^
pkg/core/consensus/threshold.go:34:2: S1008: should use 'return scoreInt.Cmp(t.limit) == -1' instead of 'if scoreInt.Cmp(t.limit) == -1 { return true }; return false' (gosimple)
        if scoreInt.Cmp(t.limit) == -1 {
        ^
pkg/core/consensus/round.go:265:2: S1031: unnecessary nil check around range (gosimple)
        if evs != nil {
        ^
pkg/gql/query/query_test.go:48:5: `comparision` is a misspelling of `comparison` (misspell)
        // comparision easier
           ^
pkg/gql/query/mempool.go:42:4: G104: Errors unhandled. (gosec)
                        payload.Write(txidBytes)
                        ^
pkg/gql/query/blocks.go:249:47: unnecessary conversion (unconvert)
                hash, err := t.FetchBlockHashByHeight(uint64(height))
                                                            ^
pkg/gql/query/transactions.go:210:48: unnecessary conversion (unconvert)
                        hash, err := t.FetchBlockHashByHeight(uint64(height))
                                                                    ^
harness/engine/node.go:32:24: string `unix` has 3 occurrences, make it a constant (goconst)
        if *RPCNetworkType == "unix" {
                              ^
harness/engine/utils.go:204:12: S1039: unnecessary use of fmt.Sprintf (gosimple)
                query := fmt.Sprintf(
                         ^
harness/engine/utils.go:67:24: response body must be closed (bodyclose)
        resp, err := http.Post(addr, "application/json", &buf)
                              ^
pkg/core/consensus/candidate/generation_test.go:36:2: S1005: unnecessary assignment to the blank identifier (gosimple)
        _ = <-h.ScoreChan
        ^
pkg/core/mempool/hashmap_test.go:35:9: `previos` is a misspelling of `previous` (misspell)
        // the previos one
               ^
pkg/core/mempool/mempool_test.go:316:5: `differnt` is a misspelling of `different` (misspell)
        // differnt TxID
           ^
pkg/core/tests/helper/transactions.go:311:53: unnecessary conversion (unconvert)
        seedScalar.SetBigInt(big.NewInt(0).SetUint64(uint64(seed)))
                                                           ^
pkg/config/consts.go:33:7: string `testnet` has 4 occurrences, make it a constant (goconst)
        case "testnet":
             ^
pkg/config/loader_test.go:35:27: string `debug` has 3 occurrences, make it a constant (goconst)
        if Get().Logger.Level != "debug" {
                                 ^
pkg/p2p/wire/protocol/protocol_test.go:43:2: SA2002: the goroutine calls T.Fatal, which must be called in the same goroutine as the test (staticcheck)
        go delayedWrite(t, pw)
        ^
pkg/p2p/wire/protocol/protocol_test.go:56:2: SA2002: the goroutine calls T.Fatal, which must be called in the same goroutine as the test (staticcheck)
        go delayedWrite(t, pw)
        ^
pkg/p2p/wire/message/transactions_test.go:243:30: `overriden` is a misspelling of `overridden` (misspell)
// Test that the tx type has overriden the standard hash function
                             ^
pkg/util/diagnostics/profile.go:144:7: string `mutex` has 3 occurrences, make it a constant (goconst)
        case "mutex":
             ^
pkg/util/diagnostics/profile.go:147:7: string `block` has 3 occurrences, make it a constant (goconst)
        case "block":
             ^
pkg/util/diagnostics/profile.go:150:7: string `heap` has 3 occurrences, make it a constant (goconst)
        case "heap", "goroutine":
             ^
pkg/util/diagnostics/profile.go:152:7: string `memstats` has 3 occurrences, make it a constant (goconst)
        case "memstats":
             ^
pkg/util/diagnostics/profile.go:155:7: string `cpu` has 3 occurrences, make it a constant (goconst)
        case "cpu":
             ^
pkg/core/database/heavy/transactions.go:630:25: unnecessary conversion (unconvert)
                height := tip - uint64(n) + uint64(pos)
                                      ^
pkg/core/database/heavy/transactions.go:648:21: unnecessary conversion (unconvert)
        return tip - uint64(n) + uint64(pos), nil
                           ^
pkg/core/consensus/maintainer/maintainer.go:56:2: S1000: should use for range instead of for { select {} } (gosimple)
        for {
        ^
pkg/core/consensus/user/provisioners_test.go:44:2: SA4006: this value of `p` is never used (staticcheck)
        p := &user.Provisioners{}
        ^
devtomnl commented 4 years ago

done