From 8f443ba4bf956927317e2e5df341ce5afc7bef7f Mon Sep 17 00:00:00 2001 From: adam Date: Wed, 30 Jan 2019 18:30:06 -0800 Subject: [PATCH] general linting fixes --- client/p2p/peers/discovery.go | 4 +- common/fileflatdb/util.go | 2 +- common/hexutil/hexutil.go | 2 +- common/stringutil/stringutil.go | 2 +- common/triecodec/decode_test.go | 12 +- common/triecodec/encode_test.go | 12 +- common/triedb/snapshot_test.go | 12 +- common/triehash/unhashedtrie_test.go | 56 ++++----- common/u8util/u8util_test.go | 4 +- .../go-interpreter/wagon/wasm/index.go | 108 +++++++++--------- vendor/github.com/ipfs/go-datastore/batch.go | 2 +- .../ipfs/go-log/tracer/wire/wire.pb.go | 2 +- .../github.com/jbenet/goprocess/impl-mutex.go | 6 +- .../libp2p/go-libp2p-peer/peerset/peerset.go | 2 +- .../libp2p/go-libp2p-peerstore/peerstore.go | 2 +- .../libp2p/go-libp2p-swarm/swarm.go | 2 +- .../perlin-network/life/compiler/gas.go | 2 +- .../github.com/perlin-network/life/exec/vm.go | 4 +- vendor/github.com/ugorji/go/codec/0doc.go | 1 - .../whyrusleeping/go-logging/logger.go | 2 +- .../x/text/encoding/unicode/unicode.go | 4 +- vendor/golang.org/x/text/language/gen.go | 2 +- vendor/golang.org/x/text/language/lookup.go | 56 ++++----- vendor/golang.org/x/text/language/tables.go | 6 +- 24 files changed, 153 insertions(+), 154 deletions(-) diff --git a/client/p2p/peers/discovery.go b/client/p2p/peers/discovery.go index 49fcbbd..bca3503 100644 --- a/client/p2p/peers/discovery.go +++ b/client/p2p/peers/discovery.go @@ -17,9 +17,9 @@ type DiscoveryNotifee struct { // HandlePeerFound ... func (d *DiscoveryNotifee) HandlePeerFound(pi peerstore.PeerInfo) { - kp, err := d.peers.Get(pi) + _, err := d.peers.Get(pi) if err == ErrNoSuchPeer { - kp, err = d.peers.Add(pi) + kp, err := d.peers.Add(pi) if err != nil { logger.Errorf("[peers] err adding peer with info %v\n%v", pi, err) return diff --git a/common/fileflatdb/util.go b/common/fileflatdb/util.go index 8b02975..e28c3dd 100644 --- a/common/fileflatdb/util.go +++ b/common/fileflatdb/util.go @@ -20,7 +20,7 @@ func writeUIntBE(buffer []byte, value, offset, byteLength int64) { } slice = buf.Bytes() - slice = slice[int64(len(slice))-byteLength : len(slice)] + slice = slice[int64(len(slice))-byteLength:] copy(buffer[offset:], slice) } diff --git a/common/hexutil/hexutil.go b/common/hexutil/hexutil.go index d12b278..7f5bede 100644 --- a/common/hexutil/hexutil.go +++ b/common/hexutil/hexutil.go @@ -80,7 +80,7 @@ func HexFixLength(hexStr string, bitLength int, withPadding bool) string { paddedHexStr := fmt.Sprintf("%s%s", strings.Repeat("0", strLen), strippedHexStr) return AddPrefix( - paddedHexStr[len(paddedHexStr)-strLen : len(paddedHexStr)], + paddedHexStr[len(paddedHexStr)-strLen:], ) } diff --git a/common/stringutil/stringutil.go b/common/stringutil/stringutil.go index 1d61d56..26ea5f7 100644 --- a/common/stringutil/stringutil.go +++ b/common/stringutil/stringutil.go @@ -69,7 +69,7 @@ func Shorten(value string, prefixLength int) string { } start := value[0:prefixLength] - end := value[len(value)-prefixLength : len(value)] + end := value[len(value)-prefixLength:] return fmt.Sprintf("%s..%s", start, end) } diff --git a/common/triecodec/decode_test.go b/common/triecodec/decode_test.go index 10dd96f..dbe8664 100644 --- a/common/triecodec/decode_test.go +++ b/common/triecodec/decode_test.go @@ -15,8 +15,8 @@ func TestDecode(t *testing.T) { { []uint8{0x05, 0x48, 0x19, 0x04, 0xfe}, [][]uint8{ - []uint8{0x20, 0x48, 0x19}, - []uint8{0xfe}, + {0x20, 0x48, 0x19}, + {0xfe}, }, }, { @@ -34,12 +34,12 @@ func TestDecode(t *testing.T) { nil, nil, [][]uint8{ - []uint8{0x1A}, - []uint8{0xFF, 0x0, 0xC, 0x4, 0xA0, 0x10, 0x2, 0xA, 0x4, 0xAA, 0x10, 0x2, 0xB, 0x4, 0xAB}, + {0x1A}, + {0xFF, 0x0, 0xC, 0x4, 0xA0, 0x10, 0x2, 0xA, 0x4, 0xAA, 0x10, 0x2, 0xB, 0x4, 0xAB}, }, [][]uint8{ - []uint8{0x3B}, - []uint8{0xB0}, + {0x3B}, + {0xB0}, }, nil, nil, diff --git a/common/triecodec/encode_test.go b/common/triecodec/encode_test.go index a381af5..2c06a44 100644 --- a/common/triecodec/encode_test.go +++ b/common/triecodec/encode_test.go @@ -23,8 +23,8 @@ func TestEncode(t *testing.T) { NewNull(), NewNull(), [][]uint8{ - []uint8{0x3A}, - []uint8{0xAA}, + {0x3A}, + {0xAA}, }, NewNull(), NewNull(), @@ -45,12 +45,12 @@ func TestEncode(t *testing.T) { NewNull(), NewNull(), [][]uint8{ - []uint8{0x3A}, - []uint8{0xAA}, + {0x3A}, + {0xAA}, }, [][]uint8{ - []uint8{0x3B}, - []uint8{0xAB}, + {0x3B}, + {0xAB}, }, NewNull(), NewNull(), diff --git a/common/triedb/snapshot_test.go b/common/triedb/snapshot_test.go index 8bac178..28f4d73 100644 --- a/common/triedb/snapshot_test.go +++ b/common/triedb/snapshot_test.go @@ -16,7 +16,7 @@ func TestSnapshots(t *testing.T) { back := newTrie(codec) values := []*triehash.TriePair{ - &triehash.TriePair{K: []uint8("test"), V: []uint8("one")}, + {K: []uint8("test"), V: []uint8("one")}, } root := triehash.TrieRoot(values) @@ -49,11 +49,11 @@ func TestSnapshots(t *testing.T) { // TODO: fix trie encoder to fix tests values := []*triehash.TriePair{ - &triehash.TriePair{K: []uint8("one"), V: []uint8("testing")}, - &triehash.TriePair{K: []uint8("two"), V: []uint8("testing with a much longer value here")}, - &triehash.TriePair{K: []uint8("twzei"), V: []uint8("und Deutch")}, - &triehash.TriePair{K: []uint8("do"), V: []uint8("do it")}, - &triehash.TriePair{K: []uint8("dog"), V: []uint8("doggie")}, + {K: []uint8("one"), V: []uint8("testing")}, + {K: []uint8("two"), V: []uint8("testing with a much longer value here")}, + {K: []uint8("twzei"), V: []uint8("und Deutch")}, + {K: []uint8("do"), V: []uint8("do it")}, + {K: []uint8("dog"), V: []uint8("doggie")}, //&triehash.TriePair{K: []uint8("dogge"), V: []uint8("bigger doge")}, //&triehash.TriePair{K: []uint8("dodge"), V: []uint8("coin")}, } diff --git a/common/triehash/unhashedtrie_test.go b/common/triehash/unhashedtrie_test.go index 47c8eaa..e808461 100644 --- a/common/triehash/unhashedtrie_test.go +++ b/common/triehash/unhashedtrie_test.go @@ -16,63 +16,63 @@ func TestUnhashedTrie(t *testing.T) { { // a simple branch []*TriePair{ - &TriePair{K: []uint8{0xaa}, V: []uint8{0x10}}, - &TriePair{K: []uint8{0xba}, V: []uint8{0x11}}, + {K: []uint8{0xaa}, V: []uint8{0x10}}, + {K: []uint8{0xba}, V: []uint8{0x11}}, }, []uint8{0xfe, 0x00, 0x0c, 0x10, 0x02, 0x0a, 0x04, 0x10, 0x10, 0x02, 0x0a, 0x04, 0x11}, }, { // an extension and branch []*TriePair{ - &TriePair{K: []uint8{0xaa}, V: []uint8{0x10}}, - &TriePair{K: []uint8{0xab}, V: []uint8{0x11}}, + {K: []uint8{0xaa}, V: []uint8{0x10}}, + {K: []uint8{0xab}, V: []uint8{0x11}}, }, hexToU8a("0x810a2cfe000c0c0104100c010411"), }, { // extension and branch with value []*TriePair{ - &TriePair{K: []uint8{0xaa}, V: []uint8{0xa0}}, - &TriePair{K: []uint8{0xaa, 0xaa}, V: []uint8{0xaa}}, - &TriePair{K: []uint8{0xaa, 0xbb}, V: []uint8{0xab}}, + {K: []uint8{0xaa}, V: []uint8{0xa0}}, + {K: []uint8{0xaa, 0xaa}, V: []uint8{0xaa}}, + {K: []uint8{0xaa, 0xbb}, V: []uint8{0xab}}, }, []uint8{0x82, 0xaa, 0x3c, 0xff, 0x00, 0x0c, 0x04, 0xa0, 0x10, 0x02, 0x0a, 0x04, 0xaa, 0x10, 0x02, 0x0b, 0x04, 0xab}, }, { // medium extension and branch with value []*TriePair{ - &TriePair{K: []uint8{0xaa}, V: []uint8{0xa0}}, - &TriePair{K: []uint8{0xaa, 0xaa}, V: []uint8{0xaa}}, - &TriePair{K: []uint8{0xaa, 0xbb}, V: []uint8{0xab}}, - &TriePair{K: []uint8{0xbb}, V: []uint8{0xb0}}, + {K: []uint8{0xaa}, V: []uint8{0xa0}}, + {K: []uint8{0xaa, 0xaa}, V: []uint8{0xaa}}, + {K: []uint8{0xaa, 0xbb}, V: []uint8{0xab}}, + {K: []uint8{0xbb}, V: []uint8{0xb0}}, }, []uint8{0xfe, 0x00, 0x0c, 0x48, 0x81, 0x0a, 0x3c, 0xff, 0x00, 0x0c, 0x04, 0xa0, 0x10, 0x02, 0x0a, 0x04, 0xaa, 0x10, 0x02, 0x0b, 0x04, 0xab, 0x10, 0x02, 0x0b, 0x04, 0xb0}, }, { // bigger extension and branch with value []*TriePair{ - &TriePair{K: []uint8{0xaa}, V: []uint8{0xa0}}, - &TriePair{K: []uint8{0xaa, 0xaa}, V: []uint8{0xaa}}, - &TriePair{K: []uint8{0xaa, 0xbb}, V: []uint8{0xab}}, - &TriePair{K: []uint8{0xbb}, V: []uint8{0xb0}}, - &TriePair{K: []uint8{0xbb, 0xbb}, V: []uint8{0xbb}}, - &TriePair{K: []uint8{0xbb, 0xcc}, V: []uint8{0xbc}}, + {K: []uint8{0xaa}, V: []uint8{0xa0}}, + {K: []uint8{0xaa, 0xaa}, V: []uint8{0xaa}}, + {K: []uint8{0xaa, 0xbb}, V: []uint8{0xab}}, + {K: []uint8{0xbb}, V: []uint8{0xb0}}, + {K: []uint8{0xbb, 0xbb}, V: []uint8{0xbb}}, + {K: []uint8{0xbb, 0xcc}, V: []uint8{0xbc}}, }, []uint8{0xfe, 0x00, 0x0c, 0x48, 0x81, 0x0a, 0x3c, 0xff, 0x00, 0x0c, 0x04, 0xa0, 0x10, 0x02, 0x0a, 0x04, 0xaa, 0x10, 0x02, 0x0b, 0x04, 0xab, 0x48, 0x81, 0x0b, 0x3c, 0xff, 0x00, 0x18, 0x04, 0xb0, 0x10, 0x02, 0x0b, 0x04, 0xbb, 0x10, 0x02, 0x0c, 0x04, 0xbc}, }, { // a single long leaf []*TriePair{ - &TriePair{K: []uint8{0xaa}, V: stringutil.ToUint8Slice("ABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABC")}, - &TriePair{K: []uint8{0xba}, V: []uint8{0x11}}, + {K: []uint8{0xaa}, V: stringutil.ToUint8Slice("ABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABC")}, + {K: []uint8{0xba}, V: []uint8{0x11}}, }, []uint8{0xfe, 0x00, 0x0c, 0x80, 0x0e, 0x26, 0xe9, 0x80, 0x0a, 0xc2, 0x7f, 0x56, 0x5c, 0x7e, 0x7c, 0xa7, 0x95, 0x16, 0x24, 0x78, 0x35, 0xea, 0x07, 0x6c, 0x5b, 0x62, 0x5f, 0x2d, 0x61, 0x00, 0x1a, 0x7b, 0xab, 0xad, 0xbf, 0x11, 0x10, 0x02, 0x0a, 0x04, 0x11}, }, { // two long leaves []*TriePair{ - &TriePair{K: []uint8{0xaa}, V: stringutil.ToUint8Slice("ABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABC")}, - &TriePair{K: []uint8{0xba}, V: stringutil.ToUint8Slice("ABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABC")}, + {K: []uint8{0xaa}, V: stringutil.ToUint8Slice("ABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABC")}, + {K: []uint8{0xba}, V: stringutil.ToUint8Slice("ABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABC")}, }, []uint8{0xfe, 0x00, 0x0c, 0x80, 0x0e, 0x26, 0xe9, 0x80, 0x0a, 0xc2, 0x7f, 0x56, 0x5c, 0x7e, 0x7c, 0xa7, 0x95, 0x16, 0x24, 0x78, 0x35, 0xea, 0x07, 0x6c, 0x5b, 0x62, 0x5f, 0x2d, 0x61, 0x00, 0x1a, 0x7b, 0xab, 0xad, 0xbf, 0x11, 0x80, 0x0e, 0x26, 0xe9, 0x80, 0x0a, 0xc2, 0x7f, 0x56, 0x5c, 0x7e, 0x7c, 0xa7, 0x95, 0x16, 0x24, 0x78, 0x35, 0xea, 0x07, 0x6c, 0x5b, 0x62, 0x5f, 0x2d, 0x61, 0x00, 0x1a, 0x7b, 0xab, 0xad, 0xbf, 0x11}, }, @@ -84,7 +84,7 @@ func TestUnhashedTrie(t *testing.T) { { // a single tuple []*TriePair{ - &TriePair{K: []uint8{0xaa}, V: []uint8{0xbb}}, + {K: []uint8{0xaa}, V: []uint8{0xbb}}, }, []uint8{ 0x03, // leaf (0x01) with (+) key of 2 nibbles (0x02) @@ -96,15 +96,15 @@ func TestUnhashedTrie(t *testing.T) { { // a single tuple (prepare for next) []*TriePair{ - &TriePair{K: []uint8{0x48, 0x19}, V: []uint8{0xfe}}, + {K: []uint8{0x48, 0x19}, V: []uint8{0xfe}}, }, []uint8{0x05, 0x48, 0x19, 0x04, 0xfe}, }, { // two disjointed tuple keys []*TriePair{ - &TriePair{K: []uint8{0x48, 0x19}, V: []uint8{0xfe}}, - &TriePair{K: []uint8{0x13, 0x14}, V: []uint8{0xff}}, + {K: []uint8{0x48, 0x19}, V: []uint8{0xfe}}, + {K: []uint8{0x13, 0x14}, V: []uint8{0xff}}, }, []uint8{ 0xfe, // branch, no value @@ -127,15 +127,15 @@ func TestUnhashedTrie(t *testing.T) { { // substrate (paritial 0) []*TriePair{ - &TriePair{ + { K: hexToU8a("0x3a617574683a00000000"), V: hexToU8a("0x82c39b31a2b79a90f8e66e7a77fdb85a4ed5517f2ae39f6a80565e8ecae85cf5"), }, - &TriePair{ + { K: hexToU8a("0x7935e46f94f24b82716c0142e2271de9"), V: hexToU8a("0x0087000000000000"), }, - &TriePair{ + { K: hexToU8a("0x27b3872d47181b4a2dc15f0da43e7026"), V: hexToU8a("0xe803000000000000"), }, diff --git a/common/u8util/u8util_test.go b/common/u8util/u8util_test.go index 5050cc1..49d93eb 100644 --- a/common/u8util/u8util_test.go +++ b/common/u8util/u8util_test.go @@ -14,8 +14,8 @@ func TestConcat(t *testing.T) { }{ { [][]uint8{ - []uint8{0x1, 0x2, 0x3}, - []uint8{0x4, 0x5}, + {0x1, 0x2, 0x3}, + {0x4, 0x5}, }, []uint8{0x1, 0x2, 0x3, 0x4, 0x5}, }, diff --git a/vendor/github.com/go-interpreter/wagon/wasm/index.go b/vendor/github.com/go-interpreter/wagon/wasm/index.go index 946b75f..eb6f521 100644 --- a/vendor/github.com/go-interpreter/wagon/wasm/index.go +++ b/vendor/github.com/go-interpreter/wagon/wasm/index.go @@ -92,34 +92,34 @@ func (m *Module) populateTables() error { if m.Table == nil || len(m.Table.Entries) == 0 || m.Elements == nil || len(m.Elements.Entries) == 0 { return nil } -/* - for _, elem := range m.Elements.Entries { - // the MVP dictates that index should always be zero, we shuold - // probably check this - if int(elem.Index) >= len(m.TableIndexSpace) { - return InvalidTableIndexError(elem.Index) - } - - val, err := m.ExecInitExpr(elem.Offset) - if err != nil { - return err - } - offset, ok := val.(int32) - if !ok { - return InvalidValueTypeInitExprError{reflect.Int32, reflect.TypeOf(val).Kind()} - } - - table := m.TableIndexSpace[int(elem.Index)] - if int(offset)+len(elem.Elems) > len(table) { - data := make([]uint32, int(offset)+len(elem.Elems)) - copy(data[offset:], elem.Elems) - copy(data, table) - m.TableIndexSpace[int(elem.Index)] = data - } else { - copy(table[int(offset):], elem.Elems) - m.TableIndexSpace[int(elem.Index)] = table - } - }*/ + /* + for _, elem := range m.Elements.Entries { + // the MVP dictates that index should always be zero, we shuold + // probably check this + if int(elem.Index) >= len(m.TableIndexSpace) { + return InvalidTableIndexError(elem.Index) + } + + val, err := m.ExecInitExpr(elem.Offset) + if err != nil { + return err + } + offset, ok := val.(int32) + if !ok { + return InvalidValueTypeInitExprError{reflect.Int32, reflect.TypeOf(val).Kind()} + } + + table := m.TableIndexSpace[int(elem.Index)] + if int(offset)+len(elem.Elems) > len(table) { + data := make([]uint32, int(offset)+len(elem.Elems)) + copy(data[offset:], elem.Elems) + copy(data, table) + m.TableIndexSpace[int(elem.Index)] = data + } else { + copy(table[int(offset):], elem.Elems) + m.TableIndexSpace[int(elem.Index)] = table + } + }*/ logger.Printf("There are %d entries in the table index space.", len(m.TableIndexSpace)) return nil @@ -140,32 +140,32 @@ func (m *Module) populateLinearMemory() error { return nil } // each module can only have a single linear memory in the MVP -/* - for _, entry := range m.Data.Entries { - if entry.Index != 0 { - return InvalidLinearMemoryIndexError(entry.Index) - } - - val, err := m.ExecInitExpr(entry.Offset) - if err != nil { - return err - } - offset, ok := val.(int32) - if !ok { - return InvalidValueTypeInitExprError{reflect.Int32, reflect.TypeOf(val).Kind()} - } - - memory := m.LinearMemoryIndexSpace[int(entry.Index)] - if int(offset)+len(entry.Data) > len(memory) { - data := make([]byte, int(offset)+len(entry.Data)) - copy(data[offset:], entry.Data) - copy(data, memory) - m.LinearMemoryIndexSpace[int(entry.Index)] = data - } else { - copy(memory[int(offset):], entry.Data) - m.LinearMemoryIndexSpace[int(entry.Index)] = memory - } - }*/ + /* + for _, entry := range m.Data.Entries { + if entry.Index != 0 { + return InvalidLinearMemoryIndexError(entry.Index) + } + + val, err := m.ExecInitExpr(entry.Offset) + if err != nil { + return err + } + offset, ok := val.(int32) + if !ok { + return InvalidValueTypeInitExprError{reflect.Int32, reflect.TypeOf(val).Kind()} + } + + memory := m.LinearMemoryIndexSpace[int(entry.Index)] + if int(offset)+len(entry.Data) > len(memory) { + data := make([]byte, int(offset)+len(entry.Data)) + copy(data[offset:], entry.Data) + copy(data, memory) + m.LinearMemoryIndexSpace[int(entry.Index)] = data + } else { + copy(memory[int(offset):], entry.Data) + m.LinearMemoryIndexSpace[int(entry.Index)] = memory + } + }*/ return nil } diff --git a/vendor/github.com/ipfs/go-datastore/batch.go b/vendor/github.com/ipfs/go-datastore/batch.go index db11a32..3c0926e 100644 --- a/vendor/github.com/ipfs/go-datastore/batch.go +++ b/vendor/github.com/ipfs/go-datastore/batch.go @@ -34,7 +34,7 @@ func (bt *basicBatch) Commit() error { } } - for k, _ := range bt.deletes { + for k := range bt.deletes { if err := bt.target.Delete(k); err != nil { return err } diff --git a/vendor/github.com/ipfs/go-log/tracer/wire/wire.pb.go b/vendor/github.com/ipfs/go-log/tracer/wire/wire.pb.go index e5aea16..6db3dd7 100644 --- a/vendor/github.com/ipfs/go-log/tracer/wire/wire.pb.go +++ b/vendor/github.com/ipfs/go-log/tracer/wire/wire.pb.go @@ -134,7 +134,7 @@ func (m *TracerState) MarshalTo(dAtA []byte) (int, error) { i++ } if len(m.BaggageItems) > 0 { - for k, _ := range m.BaggageItems { + for k := range m.BaggageItems { dAtA[i] = 0x22 i++ v := m.BaggageItems[k] diff --git a/vendor/github.com/jbenet/goprocess/impl-mutex.go b/vendor/github.com/jbenet/goprocess/impl-mutex.go index fb86fcc..5dc1f62 100644 --- a/vendor/github.com/jbenet/goprocess/impl-mutex.go +++ b/vendor/github.com/jbenet/goprocess/impl-mutex.go @@ -176,7 +176,7 @@ func (p *process) doClose() { close(p.closing) // signal that we're shutting down (Closing) for len(p.children) > 0 || len(p.waitfors) > 0 { - for plc, _ := range p.children { + for plc := range p.children { child := plc.Child() if child != nil { // check because child may already have been removed. go child.Close() // force all children to shut down @@ -189,7 +189,7 @@ func (p *process) doClose() { // change under our feet. wf := p.waitfors p.waitfors = nil // clear them. release memory. - for w, _ := range wf { + for w := range wf { // Here, we wait UNLOCKED, so that waitfors who are in the middle of // adding a child to us can finish. we will immediately close the child. p.Unlock() @@ -244,7 +244,7 @@ func (p *process) CloseAfterChildren() error { nextToWaitFor := func() Process { p.Lock() defer p.Unlock() - for e, _ := range p.waitfors { + for e := range p.waitfors { c := e.Child() if c == nil { continue diff --git a/vendor/github.com/libp2p/go-libp2p-peer/peerset/peerset.go b/vendor/github.com/libp2p/go-libp2p-peer/peerset/peerset.go index 0cc87dd..b4feb24 100644 --- a/vendor/github.com/libp2p/go-libp2p-peer/peerset/peerset.go +++ b/vendor/github.com/libp2p/go-libp2p-peer/peerset/peerset.go @@ -64,7 +64,7 @@ func (ps *PeerSet) TryAdd(p peer.ID) bool { func (ps *PeerSet) Peers() []peer.ID { ps.lk.Lock() out := make([]peer.ID, 0, len(ps.ps)) - for p, _ := range ps.ps { + for p := range ps.ps { out = append(out, p) } ps.lk.Unlock() diff --git a/vendor/github.com/libp2p/go-libp2p-peerstore/peerstore.go b/vendor/github.com/libp2p/go-libp2p-peerstore/peerstore.go index e460b1c..b63b932 100644 --- a/vendor/github.com/libp2p/go-libp2p-peerstore/peerstore.go +++ b/vendor/github.com/libp2p/go-libp2p-peerstore/peerstore.go @@ -107,7 +107,7 @@ func (ps *peerstore) GetProtocols(p peer.ID) ([]string, error) { } var out []string - for k, _ := range pmap { + for k := range pmap { out = append(out, k) } diff --git a/vendor/github.com/libp2p/go-libp2p-swarm/swarm.go b/vendor/github.com/libp2p/go-libp2p-swarm/swarm.go index c8d6fa0..7075e54 100644 --- a/vendor/github.com/libp2p/go-libp2p-swarm/swarm.go +++ b/vendor/github.com/libp2p/go-libp2p-swarm/swarm.go @@ -401,7 +401,7 @@ func (s *Swarm) ClosePeer(p peer.ID) error { } var errs []string - for _ = range conns { + for range conns { err := <-errCh if err != nil { errs = append(errs, err.Error()) diff --git a/vendor/github.com/perlin-network/life/compiler/gas.go b/vendor/github.com/perlin-network/life/compiler/gas.go index e8abd45..d25c6f1 100644 --- a/vendor/github.com/perlin-network/life/compiler/gas.go +++ b/vendor/github.com/perlin-network/life/compiler/gas.go @@ -3,7 +3,7 @@ package compiler func (c *SSAFunctionCompiler) InsertGasCounters(gp GasPolicy) { cfg := c.NewCFGraph() - for i, _ := range cfg.Blocks { + for i := range cfg.Blocks { blk := &cfg.Blocks[i] totalCost := int64(0) for _, ins := range blk.Code { diff --git a/vendor/github.com/perlin-network/life/exec/vm.go b/vendor/github.com/perlin-network/life/exec/vm.go index 866199b..fe96563 100644 --- a/vendor/github.com/perlin-network/life/exec/vm.go +++ b/vendor/github.com/perlin-network/life/exec/vm.go @@ -129,7 +129,7 @@ func NewVirtualMachine( } m.Base.Memory = &wasm.SectionMemories{ Entries: []wasm.Memory{ - wasm.Memory{ + { Limits: wasm.ResizableLimits{ Initial: uint32(config.DefaultMemoryPages), }, @@ -143,7 +143,7 @@ func NewVirtualMachine( } m.Base.Table = &wasm.SectionTables{ Entries: []wasm.Table{ - wasm.Table{ + { Limits: wasm.ResizableLimits{ Initial: uint32(config.DefaultTableSize), }, diff --git a/vendor/github.com/ugorji/go/codec/0doc.go b/vendor/github.com/ugorji/go/codec/0doc.go index 9c8ce86..f0ec31b 100644 --- a/vendor/github.com/ugorji/go/codec/0doc.go +++ b/vendor/github.com/ugorji/go/codec/0doc.go @@ -224,4 +224,3 @@ with some caveats. See Encode documentation. */ package codec - diff --git a/vendor/github.com/whyrusleeping/go-logging/logger.go b/vendor/github.com/whyrusleeping/go-logging/logger.go index 42b4949..13aafe6 100644 --- a/vendor/github.com/whyrusleeping/go-logging/logger.go +++ b/vendor/github.com/whyrusleeping/go-logging/logger.go @@ -269,7 +269,7 @@ func (l *Logger) Debugf(format string, args ...interface{}) { func defaultArgsFormat(argc int) string { f := strings.Repeat("%s ", argc) if argc > 0 { - f = f[:len(f) - 1] + f = f[:len(f)-1] } return f } diff --git a/vendor/golang.org/x/text/encoding/unicode/unicode.go b/vendor/golang.org/x/text/encoding/unicode/unicode.go index 579cadf..bfcb4e3 100644 --- a/vendor/golang.org/x/text/encoding/unicode/unicode.go +++ b/vendor/golang.org/x/text/encoding/unicode/unicode.go @@ -158,12 +158,12 @@ func UTF16(e Endianness, b BOMPolicy) encoding.Encoding { // and recommendations. Some of the "configurations" are merely recommendations, // so multiple configurations could match. var mibValue = map[Endianness][numBOMValues]identifier.MIB{ - BigEndian: [numBOMValues]identifier.MIB{ + BigEndian: { IgnoreBOM: identifier.UTF16BE, UseBOM: identifier.UTF16, // BigEnding default is preferred by RFC 2781. // TODO: acceptBOM | strictBOM would map to UTF16BE as well. }, - LittleEndian: [numBOMValues]identifier.MIB{ + LittleEndian: { IgnoreBOM: identifier.UTF16LE, UseBOM: identifier.UTF16, // LittleEndian default is allowed and preferred on Windows. // TODO: acceptBOM | strictBOM would map to UTF16LE as well. diff --git a/vendor/golang.org/x/text/language/gen.go b/vendor/golang.org/x/text/language/gen.go index 302f194..fea288d 100644 --- a/vendor/golang.org/x/text/language/gen.go +++ b/vendor/golang.org/x/text/language/gen.go @@ -1050,7 +1050,7 @@ func (b *builder) writeRegion() { m49Index := [9]int16{} fromM49 := []uint16{} m49 := []int{} - for k, _ := range fromM49map { + for k := range fromM49map { m49 = append(m49, int(k)) } sort.Ints(m49) diff --git a/vendor/golang.org/x/text/language/lookup.go b/vendor/golang.org/x/text/language/lookup.go index 1d80ac3..3ee0e5d 100644 --- a/vendor/golang.org/x/text/language/lookup.go +++ b/vendor/golang.org/x/text/language/lookup.go @@ -344,39 +344,39 @@ var ( // grandfatheredMap holds a mapping from legacy and grandfathered tags to // their base language or index to more elaborate tag. grandfatheredMap = map[[maxLen]byte]int16{ - [maxLen]byte{'a', 'r', 't', '-', 'l', 'o', 'j', 'b', 'a', 'n'}: _jbo, // art-lojban - [maxLen]byte{'i', '-', 'a', 'm', 'i'}: _ami, // i-ami - [maxLen]byte{'i', '-', 'b', 'n', 'n'}: _bnn, // i-bnn - [maxLen]byte{'i', '-', 'h', 'a', 'k'}: _hak, // i-hak - [maxLen]byte{'i', '-', 'k', 'l', 'i', 'n', 'g', 'o', 'n'}: _tlh, // i-klingon - [maxLen]byte{'i', '-', 'l', 'u', 'x'}: _lb, // i-lux - [maxLen]byte{'i', '-', 'n', 'a', 'v', 'a', 'j', 'o'}: _nv, // i-navajo - [maxLen]byte{'i', '-', 'p', 'w', 'n'}: _pwn, // i-pwn - [maxLen]byte{'i', '-', 't', 'a', 'o'}: _tao, // i-tao - [maxLen]byte{'i', '-', 't', 'a', 'y'}: _tay, // i-tay - [maxLen]byte{'i', '-', 't', 's', 'u'}: _tsu, // i-tsu - [maxLen]byte{'n', 'o', '-', 'b', 'o', 'k'}: _nb, // no-bok - [maxLen]byte{'n', 'o', '-', 'n', 'y', 'n'}: _nn, // no-nyn - [maxLen]byte{'s', 'g', 'n', '-', 'b', 'e', '-', 'f', 'r'}: _sfb, // sgn-BE-FR - [maxLen]byte{'s', 'g', 'n', '-', 'b', 'e', '-', 'n', 'l'}: _vgt, // sgn-BE-NL - [maxLen]byte{'s', 'g', 'n', '-', 'c', 'h', '-', 'd', 'e'}: _sgg, // sgn-CH-DE - [maxLen]byte{'z', 'h', '-', 'g', 'u', 'o', 'y', 'u'}: _cmn, // zh-guoyu - [maxLen]byte{'z', 'h', '-', 'h', 'a', 'k', 'k', 'a'}: _hak, // zh-hakka - [maxLen]byte{'z', 'h', '-', 'm', 'i', 'n', '-', 'n', 'a', 'n'}: _nan, // zh-min-nan - [maxLen]byte{'z', 'h', '-', 'x', 'i', 'a', 'n', 'g'}: _hsn, // zh-xiang + {'a', 'r', 't', '-', 'l', 'o', 'j', 'b', 'a', 'n'}: _jbo, // art-lojban + {'i', '-', 'a', 'm', 'i'}: _ami, // i-ami + {'i', '-', 'b', 'n', 'n'}: _bnn, // i-bnn + {'i', '-', 'h', 'a', 'k'}: _hak, // i-hak + {'i', '-', 'k', 'l', 'i', 'n', 'g', 'o', 'n'}: _tlh, // i-klingon + {'i', '-', 'l', 'u', 'x'}: _lb, // i-lux + {'i', '-', 'n', 'a', 'v', 'a', 'j', 'o'}: _nv, // i-navajo + {'i', '-', 'p', 'w', 'n'}: _pwn, // i-pwn + {'i', '-', 't', 'a', 'o'}: _tao, // i-tao + {'i', '-', 't', 'a', 'y'}: _tay, // i-tay + {'i', '-', 't', 's', 'u'}: _tsu, // i-tsu + {'n', 'o', '-', 'b', 'o', 'k'}: _nb, // no-bok + {'n', 'o', '-', 'n', 'y', 'n'}: _nn, // no-nyn + {'s', 'g', 'n', '-', 'b', 'e', '-', 'f', 'r'}: _sfb, // sgn-BE-FR + {'s', 'g', 'n', '-', 'b', 'e', '-', 'n', 'l'}: _vgt, // sgn-BE-NL + {'s', 'g', 'n', '-', 'c', 'h', '-', 'd', 'e'}: _sgg, // sgn-CH-DE + {'z', 'h', '-', 'g', 'u', 'o', 'y', 'u'}: _cmn, // zh-guoyu + {'z', 'h', '-', 'h', 'a', 'k', 'k', 'a'}: _hak, // zh-hakka + {'z', 'h', '-', 'm', 'i', 'n', '-', 'n', 'a', 'n'}: _nan, // zh-min-nan + {'z', 'h', '-', 'x', 'i', 'a', 'n', 'g'}: _hsn, // zh-xiang // Grandfathered tags with no modern replacement will be converted as // follows: - [maxLen]byte{'c', 'e', 'l', '-', 'g', 'a', 'u', 'l', 'i', 's', 'h'}: -1, // cel-gaulish - [maxLen]byte{'e', 'n', '-', 'g', 'b', '-', 'o', 'e', 'd'}: -2, // en-GB-oed - [maxLen]byte{'i', '-', 'd', 'e', 'f', 'a', 'u', 'l', 't'}: -3, // i-default - [maxLen]byte{'i', '-', 'e', 'n', 'o', 'c', 'h', 'i', 'a', 'n'}: -4, // i-enochian - [maxLen]byte{'i', '-', 'm', 'i', 'n', 'g', 'o'}: -5, // i-mingo - [maxLen]byte{'z', 'h', '-', 'm', 'i', 'n'}: -6, // zh-min + {'c', 'e', 'l', '-', 'g', 'a', 'u', 'l', 'i', 's', 'h'}: -1, // cel-gaulish + {'e', 'n', '-', 'g', 'b', '-', 'o', 'e', 'd'}: -2, // en-GB-oed + {'i', '-', 'd', 'e', 'f', 'a', 'u', 'l', 't'}: -3, // i-default + {'i', '-', 'e', 'n', 'o', 'c', 'h', 'i', 'a', 'n'}: -4, // i-enochian + {'i', '-', 'm', 'i', 'n', 'g', 'o'}: -5, // i-mingo + {'z', 'h', '-', 'm', 'i', 'n'}: -6, // zh-min // CLDR-specific tag. - [maxLen]byte{'r', 'o', 'o', 't'}: 0, // root - [maxLen]byte{'e', 'n', '-', 'u', 's', '-', 'p', 'o', 's', 'i', 'x'}: -7, // en_US_POSIX" + {'r', 'o', 'o', 't'}: 0, // root + {'e', 'n', '-', 'u', 's', '-', 'p', 'o', 's', 'i', 'x'}: -7, // en_US_POSIX" } altTagIndex = [...]uint8{0, 17, 31, 45, 61, 74, 86, 102} diff --git a/vendor/golang.org/x/text/language/tables.go b/vendor/golang.org/x/text/language/tables.go index b738d45..a28524e 100644 --- a/vendor/golang.org/x/text/language/tables.go +++ b/vendor/golang.org/x/text/language/tables.go @@ -3348,9 +3348,9 @@ var regionToGroups = [358]uint8{ // Size: 18 bytes, 3 elements var paradigmLocales = [3][3]uint16{ - 0: [3]uint16{0x139, 0x0, 0x7b}, - 1: [3]uint16{0x13e, 0x0, 0x1f}, - 2: [3]uint16{0x3c0, 0x41, 0xee}, + 0: {0x139, 0x0, 0x7b}, + 1: {0x13e, 0x0, 0x1f}, + 2: {0x3c0, 0x41, 0xee}, } type mutualIntelligibility struct {