diff --git a/Makefile b/Makefile index 8af3b4ab9..22eabcd32 100755 --- a/Makefile +++ b/Makefile @@ -21,7 +21,7 @@ GO_MIN_VERSION := 1.5.1 GO_MAX_VERSION := 1.6.2 GO_VERSION := $(shell go version | cut -d' ' -f3 | sed 's/go//') GOLINT_CMD := golint -set_exit_status -GOFMT_CMD := gofmt -l +GOFMT_CMD := gofmt -s -l GOVET_CMD := go tool vet all: build unit-test system-test ubuntu-tests diff --git a/drivers/ovsdbDriver.go b/drivers/ovsdbDriver.go index 5eae49fb7..c8e3ea9eb 100644 --- a/drivers/ovsdbDriver.go +++ b/drivers/ovsdbDriver.go @@ -180,7 +180,7 @@ func (d *OvsdbDriver) performOvsdbOps(ops []libovsdb.Operation) error { // Create or delete an OVS bridge instance func (d *OvsdbDriver) createDeleteBridge(bridgeName, failMode string, op oper) error { namedUUIDStr := "netplugin" - brUUID := []libovsdb.UUID{libovsdb.UUID{GoUuid: namedUUIDStr}} + brUUID := []libovsdb.UUID{{GoUuid: namedUUIDStr}} protocols := []string{"OpenFlow10", "OpenFlow11", "OpenFlow12", "OpenFlow13"} opStr := "insert" if op != operCreateBridge { @@ -270,8 +270,8 @@ func (d *OvsdbDriver) CreatePort(intfName, intfType, id string, tag, burst int, // intfName is assumed to be unique enough to become uuid portUUIDStr := intfName intfUUIDStr := fmt.Sprintf("Intf%s", intfName) - portUUID := []libovsdb.UUID{libovsdb.UUID{GoUuid: portUUIDStr}} - intfUUID := []libovsdb.UUID{libovsdb.UUID{GoUuid: intfUUIDStr}} + portUUID := []libovsdb.UUID{{GoUuid: portUUIDStr}} + intfUUID := []libovsdb.UUID{{GoUuid: intfUUIDStr}} opStr := "insert" var err error @@ -493,7 +493,7 @@ func (d *OvsdbDriver) AddController(ipAddr string, portNo uint16) error { // Format target string target := fmt.Sprintf("tcp:%s:%d", ipAddr, portNo) ctrlerUUIDStr := fmt.Sprintf("local") - ctrlerUUID := []libovsdb.UUID{libovsdb.UUID{GoUuid: ctrlerUUIDStr}} + ctrlerUUID := []libovsdb.UUID{{GoUuid: ctrlerUUIDStr}} // If controller already exists, nothing to do if d.IsControllerPresent(target) { diff --git a/netmaster/resources/vlanresource_test.go b/netmaster/resources/vlanresource_test.go index e9136f211..7bc889322 100644 --- a/netmaster/resources/vlanresource_test.go +++ b/netmaster/resources/vlanresource_test.go @@ -125,7 +125,7 @@ const ( ) var vlanRsrcValidationStateMap = map[string]*vlanRsrcValidator{ - VlanRsrcValidInitID: &vlanRsrcValidator{ + VlanRsrcValidInitID: { expCfg: []AutoVLANCfgResource{ { CommonState: core.CommonState{StateDriver: nil, ID: VlanRsrcValidInitID}, @@ -139,7 +139,7 @@ var vlanRsrcValidationStateMap = map[string]*vlanRsrcValidator{ }, }, }, - VlanRsrcValidDeinitID: &vlanRsrcValidator{ + VlanRsrcValidDeinitID: { expCfg: []AutoVLANCfgResource{ { CommonState: core.CommonState{StateDriver: nil, ID: VlanRsrcValidDeinitID}, @@ -157,7 +157,7 @@ var vlanRsrcValidationStateMap = map[string]*vlanRsrcValidator{ }, }, }, - VlanRsrcAllocateID: &vlanRsrcValidator{ + VlanRsrcAllocateID: { expCfg: []AutoVLANCfgResource{ { CommonState: core.CommonState{StateDriver: nil, ID: VlanRsrcAllocateID}, @@ -179,7 +179,7 @@ var vlanRsrcValidationStateMap = map[string]*vlanRsrcValidator{ }, }, }, - VlanRsrcAllocateExhaustID: &vlanRsrcValidator{ + VlanRsrcAllocateExhaustID: { expCfg: []AutoVLANCfgResource{ { CommonState: core.CommonState{StateDriver: nil, ID: VlanRsrcAllocateExhaustID}, @@ -197,7 +197,7 @@ var vlanRsrcValidationStateMap = map[string]*vlanRsrcValidator{ }, }, }, - VlanRsrcDeallocateID: &vlanRsrcValidator{ + VlanRsrcDeallocateID: { expCfg: []AutoVLANCfgResource{ { CommonState: core.CommonState{StateDriver: nil, ID: VlanRsrcDeallocateID}, @@ -227,7 +227,7 @@ var vlanRsrcValidationStateMap = map[string]*vlanRsrcValidator{ }, }, }, - VlanRsrcGetListID: &vlanRsrcValidator{ + VlanRsrcGetListID: { expCfg: []AutoVLANCfgResource{ { CommonState: core.CommonState{StateDriver: nil, ID: VlanRsrcGetListID}, diff --git a/netmaster/resources/vxlanresource_test.go b/netmaster/resources/vxlanresource_test.go index 867fe2b67..54e79e7f4 100644 --- a/netmaster/resources/vxlanresource_test.go +++ b/netmaster/resources/vxlanresource_test.go @@ -130,7 +130,7 @@ const ( ) var vxlanRsrcValidationStateMap = map[string]*vxlanRsrcValidator{ - VXLANRsrcValidInitID: &vxlanRsrcValidator{ + VXLANRsrcValidInitID: { expCfg: []AutoVXLANCfgResource{ { CommonState: core.CommonState{StateDriver: nil, ID: VXLANRsrcValidInitID}, @@ -146,7 +146,7 @@ var vxlanRsrcValidationStateMap = map[string]*vxlanRsrcValidator{ }, }, }, - VXLANRsrcValidDeinitID: &vxlanRsrcValidator{ + VXLANRsrcValidDeinitID: { expCfg: []AutoVXLANCfgResource{ { CommonState: core.CommonState{StateDriver: nil, ID: VXLANRsrcValidDeinitID}, @@ -167,7 +167,7 @@ var vxlanRsrcValidationStateMap = map[string]*vxlanRsrcValidator{ }, }, }, - VXLANRsrcAllocateID: &vxlanRsrcValidator{ + VXLANRsrcAllocateID: { expCfg: []AutoVXLANCfgResource{ { CommonState: core.CommonState{StateDriver: nil, ID: VXLANRsrcAllocateID}, @@ -193,7 +193,7 @@ var vxlanRsrcValidationStateMap = map[string]*vxlanRsrcValidator{ }, }, }, - VXLANRsrcAllocateExhaustVXLANID: &vxlanRsrcValidator{ + VXLANRsrcAllocateExhaustVXLANID: { expCfg: []AutoVXLANCfgResource{ { CommonState: core.CommonState{StateDriver: nil, ID: VXLANRsrcAllocateExhaustVXLANID}, @@ -214,7 +214,7 @@ var vxlanRsrcValidationStateMap = map[string]*vxlanRsrcValidator{ }, }, }, - VXLANRsrcAllocateExhaustVLANID: &vxlanRsrcValidator{ + VXLANRsrcAllocateExhaustVLANID: { expCfg: []AutoVXLANCfgResource{ { CommonState: core.CommonState{StateDriver: nil, ID: VXLANRsrcAllocateExhaustVLANID}, @@ -235,7 +235,7 @@ var vxlanRsrcValidationStateMap = map[string]*vxlanRsrcValidator{ }, }, }, - VXLANRsrcDeallocateID: &vxlanRsrcValidator{ + VXLANRsrcDeallocateID: { expCfg: []AutoVXLANCfgResource{ { CommonState: core.CommonState{StateDriver: nil, ID: VXLANRsrcDeallocateID}, @@ -271,7 +271,7 @@ var vxlanRsrcValidationStateMap = map[string]*vxlanRsrcValidator{ }, }, }, - VXLANRsrcGetListID: &vxlanRsrcValidator{ + VXLANRsrcGetListID: { expCfg: []AutoVXLANCfgResource{ { CommonState: core.CommonState{StateDriver: nil, ID: VXLANRsrcGetListID}, diff --git a/utils/driverfactory.go b/utils/driverfactory.go index 0ac655544..b282cc234 100644 --- a/utils/driverfactory.go +++ b/utils/driverfactory.go @@ -17,28 +17,28 @@ type driverConfigTypes struct { } var networkDriverRegistry = map[string]driverConfigTypes{ - OvsNameStr: driverConfigTypes{ + OvsNameStr: { DriverType: reflect.TypeOf(drivers.OvsDriver{}), ConfigType: reflect.TypeOf(drivers.OvsDriver{}), }, // fakedriver is used for tests, so not exposing a public name for it. - "fakedriver": driverConfigTypes{ + "fakedriver": { DriverType: reflect.TypeOf(drivers.FakeNetEpDriver{}), ConfigType: reflect.TypeOf(drivers.FakeNetEpDriverConfig{}), }, } var stateDriverRegistry = map[string]driverConfigTypes{ - EtcdNameStr: driverConfigTypes{ + EtcdNameStr: { DriverType: reflect.TypeOf(state.EtcdStateDriver{}), ConfigType: reflect.TypeOf(state.EtcdStateDriverConfig{}), }, - ConsulNameStr: driverConfigTypes{ + ConsulNameStr: { DriverType: reflect.TypeOf(state.ConsulStateDriver{}), ConfigType: reflect.TypeOf(state.ConsulStateDriverConfig{}), }, // fakestate-driver is used for tests, so not exposing a public name for it. - "fakedriver": driverConfigTypes{ + "fakedriver": { DriverType: reflect.TypeOf(state.FakeStateDriver{}), ConfigType: reflect.TypeOf(state.FakeStateDriverConfig{}), },