Skip to content

Commit 2531201

Browse files
kolyshkindims
authored andcommitted
utils/cpuload/netlink: fix errcheck warnings
Fix a few warnings like this one (currently masked by config): utils/cpuload/netlink/netlink.go:50:14: Error return value of `binary.Write` is not checked (errcheck) binary.Write(w, Endian, m.GenHeader) ^ Signed-off-by: Kir Kolyshkin <[email protected]>
1 parent e5e0066 commit 2531201

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

utils/cpuload/netlink/netlink.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ type netlinkMessage struct {
4747
func (m netlinkMessage) toRawMsg() (rawmsg syscall.NetlinkMessage) {
4848
rawmsg.Header = m.Header
4949
w := bytes.NewBuffer([]byte{})
50-
binary.Write(w, Endian, m.GenHeader)
50+
_ = binary.Write(w, Endian, m.GenHeader)
5151
w.Write(m.Data)
5252
rawmsg.Data = w.Bytes()
5353
return rawmsg
@@ -94,13 +94,13 @@ func addAttribute(buf *bytes.Buffer, attrType uint16, data interface{}, dataSize
9494
Type: attrType,
9595
}
9696
attr.Len += uint16(dataSize)
97-
binary.Write(buf, Endian, attr)
97+
_ = binary.Write(buf, Endian, attr)
9898
switch data := data.(type) {
9999
case string:
100-
binary.Write(buf, Endian, []byte(data))
100+
_ = binary.Write(buf, Endian, []byte(data))
101101
buf.WriteByte(0) // terminate
102102
default:
103-
binary.Write(buf, Endian, data)
103+
_ = binary.Write(buf, Endian, data)
104104
}
105105
for i := 0; i < padding(int(attr.Len), syscall.NLMSG_ALIGNTO); i++ {
106106
buf.WriteByte(0)

0 commit comments

Comments
 (0)