aboutsummaryrefslogtreecommitdiffstats
path: root/p2p
diff options
context:
space:
mode:
authorFelix Lange <fjl@twurst.com>2016-04-15 17:06:57 +0800
committerFelix Lange <fjl@twurst.com>2016-04-15 17:17:27 +0800
commit6fdd0893c3ebf57e5a9ba2af569c595c859ab902 (patch)
tree2df67265a0350b68b2f10ba2f7dcd292fef59ad0 /p2p
parent68c755a238f1a204087c2843f01d48fc6039716f (diff)
downloaddexon-6fdd0893c3ebf57e5a9ba2af569c595c859ab902.tar
dexon-6fdd0893c3ebf57e5a9ba2af569c595c859ab902.tar.gz
dexon-6fdd0893c3ebf57e5a9ba2af569c595c859ab902.tar.bz2
dexon-6fdd0893c3ebf57e5a9ba2af569c595c859ab902.tar.lz
dexon-6fdd0893c3ebf57e5a9ba2af569c595c859ab902.tar.xz
dexon-6fdd0893c3ebf57e5a9ba2af569c595c859ab902.tar.zst
dexon-6fdd0893c3ebf57e5a9ba2af569c595c859ab902.zip
all: fix go vet warnings
Diffstat (limited to 'p2p')
-rw-r--r--p2p/discover/udp_test.go2
-rw-r--r--p2p/message_test.go2
-rw-r--r--p2p/nat/natupnp.go10
-rw-r--r--p2p/server_test.go2
4 files changed, 8 insertions, 8 deletions
diff --git a/p2p/discover/udp_test.go b/p2p/discover/udp_test.go
index 3939a69a7..f43bf3726 100644
--- a/p2p/discover/udp_test.go
+++ b/p2p/discover/udp_test.go
@@ -128,7 +128,7 @@ func newUDPTest(t *testing.T) *udpTest {
func (test *udpTest) packetIn(wantError error, ptype byte, data packet) error {
enc, err := encodePacket(test.remotekey, ptype, data)
if err != nil {
- return test.errorf("packet (%d) encode error: %v", err)
+ return test.errorf("packet (%d) encode error: %v", ptype, err)
}
test.sent = append(test.sent, enc)
if err = test.udp.handlePacket(test.remoteaddr, enc); err != wantError {
diff --git a/p2p/message_test.go b/p2p/message_test.go
index 013214e21..a01f75556 100644
--- a/p2p/message_test.go
+++ b/p2p/message_test.go
@@ -58,7 +58,7 @@ loop:
if err := SendItems(rw1, 1); err == nil {
t.Error("EncodeMsg returned nil error")
} else if err != ErrPipeClosed {
- t.Error("EncodeMsg returned wrong error: got %v, want %v", err, ErrPipeClosed)
+ t.Errorf("EncodeMsg returned wrong error: got %v, want %v", err, ErrPipeClosed)
}
close(done)
}()
diff --git a/p2p/nat/natupnp.go b/p2p/nat/natupnp.go
index 804396e94..6b3fa3f7a 100644
--- a/p2p/nat/natupnp.go
+++ b/p2p/nat/natupnp.go
@@ -107,9 +107,9 @@ func discoverUPnP() Interface {
go discover(found, internetgateway1.URN_WANConnectionDevice_1, func(dev *goupnp.RootDevice, sc goupnp.ServiceClient) *upnp {
switch sc.Service.ServiceType {
case internetgateway1.URN_WANIPConnection_1:
- return &upnp{dev, "IGDv1-IP1", &internetgateway1.WANIPConnection1{sc}}
+ return &upnp{dev, "IGDv1-IP1", &internetgateway1.WANIPConnection1{ServiceClient: sc}}
case internetgateway1.URN_WANPPPConnection_1:
- return &upnp{dev, "IGDv1-PPP1", &internetgateway1.WANPPPConnection1{sc}}
+ return &upnp{dev, "IGDv1-PPP1", &internetgateway1.WANPPPConnection1{ServiceClient: sc}}
}
return nil
})
@@ -117,11 +117,11 @@ func discoverUPnP() Interface {
go discover(found, internetgateway2.URN_WANConnectionDevice_2, func(dev *goupnp.RootDevice, sc goupnp.ServiceClient) *upnp {
switch sc.Service.ServiceType {
case internetgateway2.URN_WANIPConnection_1:
- return &upnp{dev, "IGDv2-IP1", &internetgateway2.WANIPConnection1{sc}}
+ return &upnp{dev, "IGDv2-IP1", &internetgateway2.WANIPConnection1{ServiceClient: sc}}
case internetgateway2.URN_WANIPConnection_2:
- return &upnp{dev, "IGDv2-IP2", &internetgateway2.WANIPConnection2{sc}}
+ return &upnp{dev, "IGDv2-IP2", &internetgateway2.WANIPConnection2{ServiceClient: sc}}
case internetgateway2.URN_WANPPPConnection_1:
- return &upnp{dev, "IGDv2-PPP1", &internetgateway2.WANPPPConnection1{sc}}
+ return &upnp{dev, "IGDv2-PPP1", &internetgateway2.WANPPPConnection1{ServiceClient: sc}}
}
return nil
})
diff --git a/p2p/server_test.go b/p2p/server_test.go
index 976d5baf5..02d1c8e01 100644
--- a/p2p/server_test.go
+++ b/p2p/server_test.go
@@ -123,7 +123,7 @@ func TestServerDial(t *testing.T) {
// run a one-shot TCP server to handle the connection.
listener, err := net.Listen("tcp", "127.0.0.1:0")
if err != nil {
- t.Fatalf("could not setup listener: %v")
+ t.Fatalf("could not setup listener: %v", err)
}
defer listener.Close()
accepted := make(chan net.Conn)