Skip to content

Commit

Permalink
Merge pull request #591 from erikh/gofmt
Browse files Browse the repository at this point in the history
Makefile,drivers: Switch to using `gofmt -s` and correct areas where it does not pass
  • Loading branch information
abhi authored Nov 3, 2016
2 parents 6eca380 + 017c6b3 commit 5e2cc57
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 23 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions drivers/ovsdbDriver.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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) {
Expand Down
12 changes: 6 additions & 6 deletions netmaster/resources/vlanresource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ const (
)

var vlanRsrcValidationStateMap = map[string]*vlanRsrcValidator{
VlanRsrcValidInitID: &vlanRsrcValidator{
VlanRsrcValidInitID: {
expCfg: []AutoVLANCfgResource{
{
CommonState: core.CommonState{StateDriver: nil, ID: VlanRsrcValidInitID},
Expand All @@ -139,7 +139,7 @@ var vlanRsrcValidationStateMap = map[string]*vlanRsrcValidator{
},
},
},
VlanRsrcValidDeinitID: &vlanRsrcValidator{
VlanRsrcValidDeinitID: {
expCfg: []AutoVLANCfgResource{
{
CommonState: core.CommonState{StateDriver: nil, ID: VlanRsrcValidDeinitID},
Expand All @@ -157,7 +157,7 @@ var vlanRsrcValidationStateMap = map[string]*vlanRsrcValidator{
},
},
},
VlanRsrcAllocateID: &vlanRsrcValidator{
VlanRsrcAllocateID: {
expCfg: []AutoVLANCfgResource{
{
CommonState: core.CommonState{StateDriver: nil, ID: VlanRsrcAllocateID},
Expand All @@ -179,7 +179,7 @@ var vlanRsrcValidationStateMap = map[string]*vlanRsrcValidator{
},
},
},
VlanRsrcAllocateExhaustID: &vlanRsrcValidator{
VlanRsrcAllocateExhaustID: {
expCfg: []AutoVLANCfgResource{
{
CommonState: core.CommonState{StateDriver: nil, ID: VlanRsrcAllocateExhaustID},
Expand All @@ -197,7 +197,7 @@ var vlanRsrcValidationStateMap = map[string]*vlanRsrcValidator{
},
},
},
VlanRsrcDeallocateID: &vlanRsrcValidator{
VlanRsrcDeallocateID: {
expCfg: []AutoVLANCfgResource{
{
CommonState: core.CommonState{StateDriver: nil, ID: VlanRsrcDeallocateID},
Expand Down Expand Up @@ -227,7 +227,7 @@ var vlanRsrcValidationStateMap = map[string]*vlanRsrcValidator{
},
},
},
VlanRsrcGetListID: &vlanRsrcValidator{
VlanRsrcGetListID: {
expCfg: []AutoVLANCfgResource{
{
CommonState: core.CommonState{StateDriver: nil, ID: VlanRsrcGetListID},
Expand Down
14 changes: 7 additions & 7 deletions netmaster/resources/vxlanresource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ const (
)

var vxlanRsrcValidationStateMap = map[string]*vxlanRsrcValidator{
VXLANRsrcValidInitID: &vxlanRsrcValidator{
VXLANRsrcValidInitID: {
expCfg: []AutoVXLANCfgResource{
{
CommonState: core.CommonState{StateDriver: nil, ID: VXLANRsrcValidInitID},
Expand All @@ -146,7 +146,7 @@ var vxlanRsrcValidationStateMap = map[string]*vxlanRsrcValidator{
},
},
},
VXLANRsrcValidDeinitID: &vxlanRsrcValidator{
VXLANRsrcValidDeinitID: {
expCfg: []AutoVXLANCfgResource{
{
CommonState: core.CommonState{StateDriver: nil, ID: VXLANRsrcValidDeinitID},
Expand All @@ -167,7 +167,7 @@ var vxlanRsrcValidationStateMap = map[string]*vxlanRsrcValidator{
},
},
},
VXLANRsrcAllocateID: &vxlanRsrcValidator{
VXLANRsrcAllocateID: {
expCfg: []AutoVXLANCfgResource{
{
CommonState: core.CommonState{StateDriver: nil, ID: VXLANRsrcAllocateID},
Expand All @@ -193,7 +193,7 @@ var vxlanRsrcValidationStateMap = map[string]*vxlanRsrcValidator{
},
},
},
VXLANRsrcAllocateExhaustVXLANID: &vxlanRsrcValidator{
VXLANRsrcAllocateExhaustVXLANID: {
expCfg: []AutoVXLANCfgResource{
{
CommonState: core.CommonState{StateDriver: nil, ID: VXLANRsrcAllocateExhaustVXLANID},
Expand All @@ -214,7 +214,7 @@ var vxlanRsrcValidationStateMap = map[string]*vxlanRsrcValidator{
},
},
},
VXLANRsrcAllocateExhaustVLANID: &vxlanRsrcValidator{
VXLANRsrcAllocateExhaustVLANID: {
expCfg: []AutoVXLANCfgResource{
{
CommonState: core.CommonState{StateDriver: nil, ID: VXLANRsrcAllocateExhaustVLANID},
Expand All @@ -235,7 +235,7 @@ var vxlanRsrcValidationStateMap = map[string]*vxlanRsrcValidator{
},
},
},
VXLANRsrcDeallocateID: &vxlanRsrcValidator{
VXLANRsrcDeallocateID: {
expCfg: []AutoVXLANCfgResource{
{
CommonState: core.CommonState{StateDriver: nil, ID: VXLANRsrcDeallocateID},
Expand Down Expand Up @@ -271,7 +271,7 @@ var vxlanRsrcValidationStateMap = map[string]*vxlanRsrcValidator{
},
},
},
VXLANRsrcGetListID: &vxlanRsrcValidator{
VXLANRsrcGetListID: {
expCfg: []AutoVXLANCfgResource{
{
CommonState: core.CommonState{StateDriver: nil, ID: VXLANRsrcGetListID},
Expand Down
10 changes: 5 additions & 5 deletions utils/driverfactory.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{}),
},
Expand Down

0 comments on commit 5e2cc57

Please sign in to comment.