gofmt: style violations have crept up

This commit is contained in:
Eugene Yakubovich 2014-10-28 17:22:52 -07:00
parent 0e908ca36d
commit ffab401087
9 changed files with 14 additions and 19 deletions

View File

@ -175,10 +175,10 @@ func boolAttr(val bool) []byte {
} }
type vxlanPortRange struct { type vxlanPortRange struct {
Lo, Hi uint16 Lo, Hi uint16
} }
func addVxlanAttrs(vxlan* Vxlan, linkInfo *nl.RtAttr) { func addVxlanAttrs(vxlan *Vxlan, linkInfo *nl.RtAttr) {
data := nl.NewRtAttrChild(linkInfo, nl.IFLA_INFO_DATA, nil) data := nl.NewRtAttrChild(linkInfo, nl.IFLA_INFO_DATA, nil)
nl.NewRtAttrChild(data, nl.IFLA_VXLAN_ID, nl.Uint32Attr(uint32(vxlan.VxlanId))) nl.NewRtAttrChild(data, nl.IFLA_VXLAN_ID, nl.Uint32Attr(uint32(vxlan.VxlanId)))
if vxlan.VtepDevIndex != 0 { if vxlan.VtepDevIndex != 0 {
@ -227,7 +227,7 @@ func addVxlanAttrs(vxlan* Vxlan, linkInfo *nl.RtAttr) {
nl.NewRtAttrChild(data, nl.IFLA_VXLAN_PORT, nl.Uint16Attr(uint16(vxlan.Port))) nl.NewRtAttrChild(data, nl.IFLA_VXLAN_PORT, nl.Uint16Attr(uint16(vxlan.Port)))
} }
if vxlan.PortLow > 0 || vxlan.PortHigh > 0 { if vxlan.PortLow > 0 || vxlan.PortHigh > 0 {
pr := vxlanPortRange{ uint16(vxlan.PortLow), uint16(vxlan.PortHigh) } pr := vxlanPortRange{uint16(vxlan.PortLow), uint16(vxlan.PortHigh)}
buf := new(bytes.Buffer) buf := new(bytes.Buffer)
binary.Write(buf, binary.BigEndian, &pr) binary.Write(buf, binary.BigEndian, &pr)

View File

@ -349,7 +349,7 @@ func TestLinkAddDelVxlan(t *testing.T) {
LinkAttrs: LinkAttrs{ LinkAttrs: LinkAttrs{
Name: "bar", Name: "bar",
}, },
VxlanId: 10, VxlanId: 10,
VtepDevIndex: parent.Index, VtepDevIndex: parent.Index,
Learning: true, Learning: true,
L2miss: true, L2miss: true,

View File

@ -47,7 +47,7 @@ type Ndmsg struct {
Family uint8 Family uint8
Index uint32 Index uint32
State uint16 State uint16
Flags uint8 Flags uint8
Type uint8 Type uint8
} }
@ -171,7 +171,6 @@ func NeighDeserialize(m []byte) (*Neigh, error) {
Flags: int(msg.Flags), Flags: int(msg.Flags),
} }
attrs, err := nl.ParseRouteAttr(m[msg.Len():]) attrs, err := nl.ParseRouteAttr(m[msg.Len():])
if err != nil { if err != nil {
return nil, err return nil, err

View File

@ -20,7 +20,7 @@ func parseMAC(s string) net.HardwareAddr {
func dumpContains(dump []Neigh, e arpEntry) bool { func dumpContains(dump []Neigh, e arpEntry) bool {
for _, n := range dump { for _, n := range dump {
if n.IP.Equal(e.ip) && (n.State & NUD_INCOMPLETE) == 0 { if n.IP.Equal(e.ip) && (n.State&NUD_INCOMPLETE) == 0 {
return true return true
} }
} }
@ -36,11 +36,11 @@ func TestNeighAddDel(t *testing.T) {
ensureIndex(dummy.Attrs()) ensureIndex(dummy.Attrs())
arpTable := []arpEntry{ arpTable := []arpEntry{
{ net.ParseIP("10.99.0.1"), parseMAC("aa:bb:cc:dd:00:01") }, {net.ParseIP("10.99.0.1"), parseMAC("aa:bb:cc:dd:00:01")},
{ net.ParseIP("10.99.0.2"), parseMAC("aa:bb:cc:dd:00:02") }, {net.ParseIP("10.99.0.2"), parseMAC("aa:bb:cc:dd:00:02")},
{ net.ParseIP("10.99.0.3"), parseMAC("aa:bb:cc:dd:00:03") }, {net.ParseIP("10.99.0.3"), parseMAC("aa:bb:cc:dd:00:03")},
{ net.ParseIP("10.99.0.4"), parseMAC("aa:bb:cc:dd:00:04") }, {net.ParseIP("10.99.0.4"), parseMAC("aa:bb:cc:dd:00:04")},
{ net.ParseIP("10.99.0.5"), parseMAC("aa:bb:cc:dd:00:05") }, {net.ParseIP("10.99.0.5"), parseMAC("aa:bb:cc:dd:00:05")},
} }
// Add the arpTable // Add the arpTable

View File

@ -45,4 +45,3 @@ func (msg *IfAddrmsg) Serialize() []byte {
func (msg *IfAddrmsg) Len() int { func (msg *IfAddrmsg) Len() int {
return syscall.SizeofIfAddrmsg return syscall.SizeofIfAddrmsg
} }

View File

@ -4,8 +4,8 @@ package nl
import ( import (
"bytes" "bytes"
"encoding/binary" "encoding/binary"
"net"
"fmt" "fmt"
"net"
"sync/atomic" "sync/atomic"
"syscall" "syscall"
"unsafe" "unsafe"
@ -304,7 +304,7 @@ func Subscribe(protocol int, groups ...uint) (*NetlinkSocket, error) {
s.lsa.Family = syscall.AF_NETLINK s.lsa.Family = syscall.AF_NETLINK
for _, g := range groups { for _, g := range groups {
s.lsa.Groups |= (1 << (g-1)) s.lsa.Groups |= (1 << (g - 1))
} }
if err := syscall.Bind(fd, &s.lsa); err != nil { if err := syscall.Bind(fd, &s.lsa); err != nil {

View File

@ -31,4 +31,3 @@ func DeserializeRtMsg(b []byte) *RtMsg {
func (msg *RtMsg) Serialize() []byte { func (msg *RtMsg) Serialize() []byte {
return (*(*[syscall.SizeofRtMsg]byte)(unsafe.Pointer(msg)))[:] return (*(*[syscall.SizeofRtMsg]byte)(unsafe.Pointer(msg)))[:]
} }

View File

@ -117,4 +117,3 @@ func DeserializeXfrmUserTmpl(b []byte) *XfrmUserTmpl {
func (msg *XfrmUserTmpl) Serialize() []byte { func (msg *XfrmUserTmpl) Serialize() []byte {
return (*(*[SizeofXfrmUserTmpl]byte)(unsafe.Pointer(msg)))[:] return (*(*[SizeofXfrmUserTmpl]byte)(unsafe.Pointer(msg)))[:]
} }

View File

@ -219,4 +219,3 @@ func DeserializeXfrmEncapTmpl(b []byte) *XfrmEncapTmpl {
func (msg *XfrmEncapTmpl) Serialize() []byte { func (msg *XfrmEncapTmpl) Serialize() []byte {
return (*(*[SizeofXfrmEncapTmpl]byte)(unsafe.Pointer(msg)))[:] return (*(*[SizeofXfrmEncapTmpl]byte)(unsafe.Pointer(msg)))[:]
} }