From 288000a8afad03be7fadf98629a4269699ff8fdf Mon Sep 17 00:00:00 2001 From: Roman Khimov Date: Thu, 17 Oct 2019 12:18:16 +0300 Subject: [PATCH 1/5] storage: drop useless nil assignment in leveldb code golint suggests: Line 24: warning: should drop = nil from declaration of var opts; it is the zero value (golint) --- pkg/core/storage/leveldb_store.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/core/storage/leveldb_store.go b/pkg/core/storage/leveldb_store.go index b2637744e..31cf8d40b 100644 --- a/pkg/core/storage/leveldb_store.go +++ b/pkg/core/storage/leveldb_store.go @@ -21,7 +21,7 @@ type LevelDBStore struct { // NewLevelDBStore return a new LevelDBStore object that will // initialize the database found at the given path. func NewLevelDBStore(cfg LevelDBOptions) (*LevelDBStore, error) { - var opts *opt.Options = nil // should be exposed via LevelDBOptions if anything needed + var opts *opt.Options // should be exposed via LevelDBOptions if anything needed db, err := leveldb.OpenFile(cfg.DataDirectoryPath, opts) if err != nil { From 6029d5a88827f190f679345b5a8046f595703681 Mon Sep 17 00:00:00 2001 From: Roman Khimov Date: Thu, 17 Oct 2019 12:19:41 +0300 Subject: [PATCH 2/5] payload: drop useless type declaration golint suggests: pkg/network/payload/address.go:48:12: should omit type net.IP from declaration of var netip; it will be inferred from the right-hand side --- pkg/network/payload/address.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/network/payload/address.go b/pkg/network/payload/address.go index eae7bc670..47c7b8b5b 100644 --- a/pkg/network/payload/address.go +++ b/pkg/network/payload/address.go @@ -45,7 +45,7 @@ func (p *AddressAndTime) EncodeBinary(bw *io.BinWriter) { // IPPortString makes a string from IP and port specified. func (p *AddressAndTime) IPPortString() string { - var netip net.IP = make(net.IP, 16) + var netip = make(net.IP, 16) copy(netip, p.IP[:]) port := strconv.Itoa(int(p.Port)) From e5ed7a7eb7d2eb0087462ea64e14092151139262 Mon Sep 17 00:00:00 2001 From: Roman Khimov Date: Thu, 17 Oct 2019 12:25:36 +0300 Subject: [PATCH 3/5] io: fix lintian suggestions in test code golint: pkg/io/binaryrw_test.go:25:11: should omit type []byte from declaration of var bin; it will be inferred from the right-hand side pkg/io/binaryrw_test.go:42:11: should omit type []byte from declaration of var bin; it will be inferred from the right-hand side pkg/io/binaryrw_test.go:118:7: should omit type string from declaration of var str; it will be inferred from the right-hand side --- pkg/io/binaryrw_test.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/io/binaryrw_test.go b/pkg/io/binaryrw_test.go index dc69a92c4..1c147f8bf 100644 --- a/pkg/io/binaryrw_test.go +++ b/pkg/io/binaryrw_test.go @@ -22,7 +22,7 @@ func TestWriteLE(t *testing.T) { var ( val uint32 = 0xdeadbeef readval uint32 - bin []byte = []byte{0xef, 0xbe, 0xad, 0xde} + bin = []byte{0xef, 0xbe, 0xad, 0xde} ) bw := NewBufBinWriter() bw.WriteLE(val) @@ -39,7 +39,7 @@ func TestWriteBE(t *testing.T) { var ( val uint32 = 0xdeadbeef readval uint32 - bin []byte = []byte{0xde, 0xad, 0xbe, 0xef} + bin = []byte{0xde, 0xad, 0xbe, 0xef} ) bw := NewBufBinWriter() bw.WriteBE(val) @@ -115,7 +115,7 @@ func TestBufBinWriterReset(t *testing.T) { func TestWriteString(t *testing.T) { var ( - str string = "teststring" + str = "teststring" ) bw := NewBufBinWriter() bw.WriteString(str) From 1b5ea67737f2a6da016fe062860c8766898a7301 Mon Sep 17 00:00:00 2001 From: Roman Khimov Date: Thu, 17 Oct 2019 12:27:15 +0300 Subject: [PATCH 4/5] core: fix ineffassign suggestion Goreport: Line 467: warning: ineffectual assignment to persisted (ineffassign) --- pkg/core/blockchain.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/core/blockchain.go b/pkg/core/blockchain.go index 03622aa9c..a20a6a5f1 100644 --- a/pkg/core/blockchain.go +++ b/pkg/core/blockchain.go @@ -464,7 +464,7 @@ func (bc *Blockchain) storeBlock(block *Block) error { func (bc *Blockchain) persist(ctx context.Context) error { var ( start = time.Now() - persisted = 0 + persisted int err error ) From 3fc2bf545255d6598e42da9034661e4920bc22df Mon Sep 17 00:00:00 2001 From: Roman Khimov Date: Thu, 17 Oct 2019 12:30:24 +0300 Subject: [PATCH 5/5] *: fix some misspellings Goreport: neo-go/pkg/core/contract_state_test.go Line 21: warning: "Contracto" is a misspelling of "Contraction" (misspell) Line 64: warning: "Contracto" is a misspelling of "Contraction" (misspell) neo-go/pkg/core/interop_neo.go Line 420: warning: "succeedes" is a misspelling of "succeeds" (misspell) neo-go/pkg/network/discovery.go Line 118: warning: "succeded" is a misspelling of "succeeded" (misspell) Line 128: warning: "successfuly" is a misspelling of "successfully" (misspell) --- pkg/core/contract_state_test.go | 4 ++-- pkg/core/interop_neo.go | 2 +- pkg/network/discovery.go | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pkg/core/contract_state_test.go b/pkg/core/contract_state_test.go index 1507ec566..9ab2e8233 100644 --- a/pkg/core/contract_state_test.go +++ b/pkg/core/contract_state_test.go @@ -18,7 +18,7 @@ func TestEncodeDecodeContractState(t *testing.T) { ParamList: []smartcontract.ParamType{smartcontract.StringType, smartcontract.IntegerType, smartcontract.Hash160Type}, ReturnType: smartcontract.BoolType, Properties: smartcontract.HasStorage, - Name: "Contracto", + Name: "Contrato", CodeVersion: "1.0.0", Author: "Joe Random", Email: "joe@example.com", @@ -61,7 +61,7 @@ func TestPutGetDeleteContractState(t *testing.T) { ParamList: []smartcontract.ParamType{smartcontract.StringType, smartcontract.IntegerType, smartcontract.Hash160Type}, ReturnType: smartcontract.BoolType, Properties: smartcontract.HasStorage, - Name: "Contracto", + Name: "Contrato", CodeVersion: "1.0.0", Author: "Joe Random", Email: "joe@example.com", diff --git a/pkg/core/interop_neo.go b/pkg/core/interop_neo.go index 19d9247cf..0dc9a1a75 100644 --- a/pkg/core/interop_neo.go +++ b/pkg/core/interop_neo.go @@ -417,7 +417,7 @@ func (ic *interopContext) storageFind(v *vm.VM) error { */ // createContractStateFromVM pops all contract state elements from the VM // evaluation stack, does a lot of checks and returns ContractState if it -// succeedes. +// succeeds. func (ic *interopContext) createContractStateFromVM(v *vm.VM) (*ContractState, error) { if ic.trigger != 0x10 { return nil, errors.New("can't create contract when not triggered by an application") diff --git a/pkg/network/discovery.go b/pkg/network/discovery.go index cbc6464a5..7d3415a6f 100644 --- a/pkg/network/discovery.go +++ b/pkg/network/discovery.go @@ -115,7 +115,7 @@ func (d *DefaultDiscovery) BadPeers() []string { } // GoodPeers returns all addresses of known good peers (that at least once -// succeded handshaking with us). +// succeeded handshaking with us). func (d *DefaultDiscovery) GoodPeers() []string { addrs := make([]string, 0, len(d.goodAddrs)) for addr := range d.goodAddrs { @@ -125,7 +125,7 @@ func (d *DefaultDiscovery) GoodPeers() []string { } // RegisterGoodAddr registers good known connected address that passed -// handshake successfuly. +// handshake successfully. func (d *DefaultDiscovery) RegisterGoodAddr(s string) { d.goodCh <- s }