Make go vet happier

This commit is contained in:
Julian Kornberger 2018-10-30 00:13:14 +01:00 committed by Alessandro Boch
parent aa5b058fc0
commit 023a6dafdc
6 changed files with 15 additions and 15 deletions

View File

@ -174,7 +174,7 @@ func (h *Handle) FilterAdd(filter Filter) error {
}
if filter.Divisor != 0 {
if (filter.Divisor-1)&filter.Divisor != 0 {
return fmt.Errorf("illegal divisor %d. Must be a power of 2.", filter.Divisor)
return fmt.Errorf("illegal divisor %d. Must be a power of 2", filter.Divisor)
}
options.AddRtAttr(nl.TCA_U32_DIVISOR, nl.Uint32Attr(filter.Divisor))
}

View File

@ -956,14 +956,14 @@ func (h *Handle) linkModify(link Link, flags int) error {
tuntap, isTuntap := link.(*Tuntap)
if base.Name == "" && !isTuntap {
return fmt.Errorf("LinkAttrs.Name cannot be empty!")
return fmt.Errorf("LinkAttrs.Name cannot be empty")
}
if isTuntap {
// TODO: support user
// TODO: support group
if tuntap.Mode < unix.IFF_TUN || tuntap.Mode > unix.IFF_TAP {
return fmt.Errorf("Tuntap.Mode %v unknown!", tuntap.Mode)
return fmt.Errorf("Tuntap.Mode %v unknown", tuntap.Mode)
}
queues := tuntap.Queues

View File

@ -1087,7 +1087,7 @@ func TestLinkSet(t *testing.T) {
}
if link.Attrs().MTU != 1400 {
t.Fatal("MTU not changed!")
t.Fatal("MTU not changed")
}
err = LinkSetTxQLen(link, 500)
@ -1101,7 +1101,7 @@ func TestLinkSet(t *testing.T) {
}
if link.Attrs().TxQLen != 500 {
t.Fatal("txqlen not changed!")
t.Fatal("txqlen not changed")
}
addr, err := net.ParseMAC("00:12:34:56:78:AB")
@ -1120,7 +1120,7 @@ func TestLinkSet(t *testing.T) {
}
if !bytes.Equal(link.Attrs().HardwareAddr, addr) {
t.Fatalf("hardware address not changed!")
t.Fatalf("hardware address not changed")
}
err = LinkSetAlias(link, "barAlias")
@ -1134,7 +1134,7 @@ func TestLinkSet(t *testing.T) {
}
if link.Attrs().Alias != "barAlias" {
t.Fatalf("alias not changed!")
t.Fatalf("alias not changed")
}
link, err = LinkByAlias("barAlias")
@ -1168,7 +1168,7 @@ func TestLinkSetARP(t *testing.T) {
}
if link.Attrs().RawFlags&unix.IFF_NOARP != uint32(unix.IFF_NOARP) {
t.Fatalf("NOARP was not set!")
t.Fatalf("NOARP was not set")
}
err = LinkSetARPOn(link)
@ -1182,7 +1182,7 @@ func TestLinkSetARP(t *testing.T) {
}
if link.Attrs().RawFlags&unix.IFF_NOARP != 0 {
t.Fatalf("NOARP is still set!")
t.Fatalf("NOARP is still set")
}
}
@ -1958,7 +1958,7 @@ func TestLinkSetAllmulticast(t *testing.T) {
}
if link.Attrs().RawFlags&unix.IFF_ALLMULTI != uint32(unix.IFF_ALLMULTI) {
t.Fatal("IFF_ALLMULTI was not set!")
t.Fatal("IFF_ALLMULTI was not set")
}
if err := LinkSetAllmulticastOff(link); err != nil {
@ -1971,7 +1971,7 @@ func TestLinkSetAllmulticast(t *testing.T) {
}
if link.Attrs().RawFlags&unix.IFF_ALLMULTI != 0 {
t.Fatal("IFF_ALLMULTI is still set!")
t.Fatal("IFF_ALLMULTI is still set")
}
rawFlagsEnd := link.Attrs().RawFlags

View File

@ -106,7 +106,7 @@ func setUpSEG6NetlinkTest(t *testing.T) tearDownNetlinkTest {
key := string("CONFIG_IPV6_SEG6_LWTUNNEL=y")
if _, err := grepKey(key, filename); err != nil {
msg := "Skipped test because it requires SEG6_LWTUNNEL support."
log.Printf(msg)
log.Println(msg)
t.Skip(msg)
}
// Add CONFIG_IPV6_SEG6_HMAC to support seg6_hamc

View File

@ -56,7 +56,7 @@ func TestNetNsIdByPid(t *testing.T) {
defer func() {
err := netns.Set(origNs)
if err != nil {
panic("failed to restore network ns, bailing!")
panic("failed to restore network ns, bailing")
}
runtime.UnlockOSThread()
}()

View File

@ -112,7 +112,7 @@ func DecodeSEG6Srh(buf []byte) ([]net.IP, error) {
}
buf = buf[8:]
if len(buf)%16 != 0 {
err := fmt.Errorf("DecodeSEG6Srh: error parsing Segment List (buf len: %d)\n", len(buf))
err := fmt.Errorf("DecodeSEG6Srh: error parsing Segment List (buf len: %d)", len(buf))
return nil, err
}
for len(buf) > 0 {
@ -124,7 +124,7 @@ func DecodeSEG6Srh(buf []byte) ([]net.IP, error) {
func EncodeSEG6Srh(segments []net.IP) ([]byte, error) {
nsegs := len(segments) // nsegs: number of segments
if nsegs == 0 {
return nil, errors.New("EncodeSEG6Srh: No Segments\n")
return nil, errors.New("EncodeSEG6Srh: No Segments")
}
b := make([]byte, 8, 8+len(segments)*16)
native := NativeEndian()