Skip to content

Commit 7986d07

Browse files
committed
client, map, node/opts/test, mod: tidy up and fix ineffassign and typo
1 parent 5767957 commit 7986d07

File tree

6 files changed

+7
-18
lines changed

6 files changed

+7
-18
lines changed

client.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -433,6 +433,10 @@ func (c *Client) handshake(ctx context.Context) {
433433
// to derive a shared key.
434434

435435
shared, err := ECDH(sec, peerPublicKey)
436+
if err != nil {
437+
c.reportError(err)
438+
return
439+
}
436440

437441
// Use the derived shared key from Diffie-Hellman to encrypt/decrypt all future communications
438442
// with AES-256 Galois Counter Mode (GCM).

example_codec_messaging_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88
"sync"
99
)
1010

11-
// ChatMessage is an example struct that is registered on exmaple nodes, and serialized/deserialized on-the-fly.
11+
// ChatMessage is an example struct that is registered on example nodes, and serialized/deserialized on-the-fly.
1212
type ChatMessage struct {
1313
content string
1414
}

go.mod

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@ require (
1010
go.uber.org/atomic v1.5.1
1111
go.uber.org/goleak v1.0.0
1212
go.uber.org/zap v1.13.0
13-
golang.org/x/crypto v0.0.0-20191119213627-4f8c1d86b1ba
1413
golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f // indirect
15-
golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa // indirect
1614
golang.org/x/tools v0.0.0-20200129045341-207d3de1faaf // indirect
17-
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 // indirect
1815
)

go.sum

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,6 @@ golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn
5353
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
5454
golang.org/x/net v0.0.0-20190620200207-3b0461eec859 h1:R/3boaszxrf1GEUWTVDzSKVwLmSJpwZ1yqXm8j0v2QI=
5555
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
56-
golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa h1:F+8P+gmewFQYRk6JoLQLwjBCTu3mcIURZfNkVweuRKA=
57-
golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
5856
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
5957
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
6058
golang.org/x/sys v0.0.0-20190412213103-97732733099d h1:+R4KGOnez64A81RvjARKc4UT5/tI9ujCIVX+P5KiHuI=
@@ -68,15 +66,11 @@ golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtn
6866
golang.org/x/tools v0.0.0-20191108193012-7d206e10da11 h1:Yq9t9jnGoR+dBuitxdo9l6Q7xh/zOyNnYUtDKaQ3x0E=
6967
golang.org/x/tools v0.0.0-20191108193012-7d206e10da11/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
7068
golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
71-
golang.org/x/tools v0.0.0-20200128002243-345141a36859 h1:xIszjAtlVeHg9hhv6Zhntvwqowji1k2rrgoOhj/aaKw=
72-
golang.org/x/tools v0.0.0-20200128002243-345141a36859/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
7369
golang.org/x/tools v0.0.0-20200129045341-207d3de1faaf h1:mFgR10kFfr83r2+nXf0GZC2FKrFhMSs9NdJ0YdEaGiY=
7470
golang.org/x/tools v0.0.0-20200129045341-207d3de1faaf/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
7571
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
7672
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898 h1:/atklqdjdhuosWIl6AIbOeHJjicWYPqR9bpxqxYG2pA=
7773
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
78-
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
79-
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
8074
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
8175
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
8276
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=

map.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,12 +109,11 @@ func (r *requestMap) nextNonce() (<-chan message, uint64, error) {
109109
r.nonce++
110110
nonce := r.nonce
111111

112-
ch, exists := r.entries[nonce]
113-
if exists {
112+
if _, exists := r.entries[nonce]; exists {
114113
return nil, 0, errors.New("ran out of available nonce to use for making a new request")
115114
}
116115

117-
ch = make(chan message, 1)
116+
ch := make(chan message, 1)
118117
r.entries[nonce] = ch
119118

120119
return ch, nonce, nil

node_options_test.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -107,11 +107,6 @@ func TestNodeOptions(t *testing.T) {
107107
assert.NoError(t, quick.Check(e, nil))
108108

109109
f := func(publicKey PublicKey, host net.IP, port uint16) bool {
110-
h := host.String() // Make-shift 'normalizeIP(net.IP)'.
111-
if h == "<nil>" {
112-
h = ""
113-
}
114-
115110
id := NewID(publicKey, host, port)
116111

117112
n, err := NewNode(WithNodeID(id))

0 commit comments

Comments
 (0)