summaryrefslogtreecommitdiffhomepage
path: root/dhcpv4/nclient4/client_test.go
diff options
context:
space:
mode:
authorAndrea Barberio <insomniac@slackware.it>2019-05-08 13:51:39 +0100
committerinsomniac <insomniacslk@users.noreply.github.com>2019-05-08 20:08:19 +0100
commit5dea7039d65e5b94fa681b17bc4a3bf63aa47994 (patch)
tree5726ea67a6a46cef01edc18efc2ab886cb53b724 /dhcpv4/nclient4/client_test.go
parent7f47189c0d8f5c8b06ab1787a94506fbb673e6e0 (diff)
[CI] Added linters
Now the CI will also run golangci-lint Signed-off-by: Andrea Barberio <insomniac@slackware.it>
Diffstat (limited to 'dhcpv4/nclient4/client_test.go')
-rw-r--r--dhcpv4/nclient4/client_test.go12
1 files changed, 7 insertions, 5 deletions
diff --git a/dhcpv4/nclient4/client_test.go b/dhcpv4/nclient4/client_test.go
index 6d7da1f..274c94b 100644
--- a/dhcpv4/nclient4/client_test.go
+++ b/dhcpv4/nclient4/client_test.go
@@ -37,7 +37,7 @@ func (h *handler) handle(conn net.PacketConn, peer net.Addr, m *dhcpv4.DHCPv4) {
if len(h.responses) > 0 {
for _, resp := range h.responses[0] {
- conn.WriteTo(resp.ToBytes(), peer)
+ _, _ = conn.WriteTo(resp.ToBytes(), peer)
}
h.responses = h.responses[1:]
}
@@ -65,7 +65,9 @@ func serveAndClient(ctx context.Context, responses [][]*dhcpv4.DHCPv4, opts ...C
if err != nil {
panic(err)
}
- go s.Serve()
+ go func() {
+ _ = s.Serve()
+ }()
return mc, serverConn
}
@@ -77,7 +79,7 @@ func ComparePacket(got *dhcpv4.DHCPv4, want *dhcpv4.DHCPv4) error {
if (want == nil || got == nil) && (got != want) {
return fmt.Errorf("packet got %v, want %v", got, want)
}
- if bytes.Compare(got.ToBytes(), want.ToBytes()) != 0 {
+ if !bytes.Equal(got.ToBytes(), want.ToBytes()) {
return fmt.Errorf("packet got %v, want %v", got, want)
}
return nil
@@ -266,8 +268,8 @@ func TestSimpleSendAndReadDiscardGarbage(t *testing.T) {
defer mc.Close()
// Too short for valid DHCPv4 packet.
- udpConn.WriteTo([]byte{0x01}, nil)
- udpConn.WriteTo([]byte{0x01, 0x2}, nil)
+ _, _ = udpConn.WriteTo([]byte{0x01}, nil)
+ _, _ = udpConn.WriteTo([]byte{0x01, 0x2}, nil)
rcvd, err := mc.SendAndRead(ctx, DefaultServers, pkt, nil)
if err != nil {