Skip to content

Commit 5e2cc57

Browse files
authored
Merge pull request #591 from erikh/gofmt
Makefile,drivers: Switch to using `gofmt -s` and correct areas where it does not pass
2 parents 6eca380 + 017c6b3 commit 5e2cc57

File tree

5 files changed

+23
-23
lines changed

5 files changed

+23
-23
lines changed

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ GO_MIN_VERSION := 1.5.1
2121
GO_MAX_VERSION := 1.6.2
2222
GO_VERSION := $(shell go version | cut -d' ' -f3 | sed 's/go//')
2323
GOLINT_CMD := golint -set_exit_status
24-
GOFMT_CMD := gofmt -l
24+
GOFMT_CMD := gofmt -s -l
2525
GOVET_CMD := go tool vet
2626

2727
all: build unit-test system-test ubuntu-tests

drivers/ovsdbDriver.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ func (d *OvsdbDriver) performOvsdbOps(ops []libovsdb.Operation) error {
180180
// Create or delete an OVS bridge instance
181181
func (d *OvsdbDriver) createDeleteBridge(bridgeName, failMode string, op oper) error {
182182
namedUUIDStr := "netplugin"
183-
brUUID := []libovsdb.UUID{libovsdb.UUID{GoUuid: namedUUIDStr}}
183+
brUUID := []libovsdb.UUID{{GoUuid: namedUUIDStr}}
184184
protocols := []string{"OpenFlow10", "OpenFlow11", "OpenFlow12", "OpenFlow13"}
185185
opStr := "insert"
186186
if op != operCreateBridge {
@@ -270,8 +270,8 @@ func (d *OvsdbDriver) CreatePort(intfName, intfType, id string, tag, burst int,
270270
// intfName is assumed to be unique enough to become uuid
271271
portUUIDStr := intfName
272272
intfUUIDStr := fmt.Sprintf("Intf%s", intfName)
273-
portUUID := []libovsdb.UUID{libovsdb.UUID{GoUuid: portUUIDStr}}
274-
intfUUID := []libovsdb.UUID{libovsdb.UUID{GoUuid: intfUUIDStr}}
273+
portUUID := []libovsdb.UUID{{GoUuid: portUUIDStr}}
274+
intfUUID := []libovsdb.UUID{{GoUuid: intfUUIDStr}}
275275
opStr := "insert"
276276

277277
var err error
@@ -493,7 +493,7 @@ func (d *OvsdbDriver) AddController(ipAddr string, portNo uint16) error {
493493
// Format target string
494494
target := fmt.Sprintf("tcp:%s:%d", ipAddr, portNo)
495495
ctrlerUUIDStr := fmt.Sprintf("local")
496-
ctrlerUUID := []libovsdb.UUID{libovsdb.UUID{GoUuid: ctrlerUUIDStr}}
496+
ctrlerUUID := []libovsdb.UUID{{GoUuid: ctrlerUUIDStr}}
497497

498498
// If controller already exists, nothing to do
499499
if d.IsControllerPresent(target) {

netmaster/resources/vlanresource_test.go

+6-6
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ const (
125125
)
126126

127127
var vlanRsrcValidationStateMap = map[string]*vlanRsrcValidator{
128-
VlanRsrcValidInitID: &vlanRsrcValidator{
128+
VlanRsrcValidInitID: {
129129
expCfg: []AutoVLANCfgResource{
130130
{
131131
CommonState: core.CommonState{StateDriver: nil, ID: VlanRsrcValidInitID},
@@ -139,7 +139,7 @@ var vlanRsrcValidationStateMap = map[string]*vlanRsrcValidator{
139139
},
140140
},
141141
},
142-
VlanRsrcValidDeinitID: &vlanRsrcValidator{
142+
VlanRsrcValidDeinitID: {
143143
expCfg: []AutoVLANCfgResource{
144144
{
145145
CommonState: core.CommonState{StateDriver: nil, ID: VlanRsrcValidDeinitID},
@@ -157,7 +157,7 @@ var vlanRsrcValidationStateMap = map[string]*vlanRsrcValidator{
157157
},
158158
},
159159
},
160-
VlanRsrcAllocateID: &vlanRsrcValidator{
160+
VlanRsrcAllocateID: {
161161
expCfg: []AutoVLANCfgResource{
162162
{
163163
CommonState: core.CommonState{StateDriver: nil, ID: VlanRsrcAllocateID},
@@ -179,7 +179,7 @@ var vlanRsrcValidationStateMap = map[string]*vlanRsrcValidator{
179179
},
180180
},
181181
},
182-
VlanRsrcAllocateExhaustID: &vlanRsrcValidator{
182+
VlanRsrcAllocateExhaustID: {
183183
expCfg: []AutoVLANCfgResource{
184184
{
185185
CommonState: core.CommonState{StateDriver: nil, ID: VlanRsrcAllocateExhaustID},
@@ -197,7 +197,7 @@ var vlanRsrcValidationStateMap = map[string]*vlanRsrcValidator{
197197
},
198198
},
199199
},
200-
VlanRsrcDeallocateID: &vlanRsrcValidator{
200+
VlanRsrcDeallocateID: {
201201
expCfg: []AutoVLANCfgResource{
202202
{
203203
CommonState: core.CommonState{StateDriver: nil, ID: VlanRsrcDeallocateID},
@@ -227,7 +227,7 @@ var vlanRsrcValidationStateMap = map[string]*vlanRsrcValidator{
227227
},
228228
},
229229
},
230-
VlanRsrcGetListID: &vlanRsrcValidator{
230+
VlanRsrcGetListID: {
231231
expCfg: []AutoVLANCfgResource{
232232
{
233233
CommonState: core.CommonState{StateDriver: nil, ID: VlanRsrcGetListID},

netmaster/resources/vxlanresource_test.go

+7-7
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ const (
130130
)
131131

132132
var vxlanRsrcValidationStateMap = map[string]*vxlanRsrcValidator{
133-
VXLANRsrcValidInitID: &vxlanRsrcValidator{
133+
VXLANRsrcValidInitID: {
134134
expCfg: []AutoVXLANCfgResource{
135135
{
136136
CommonState: core.CommonState{StateDriver: nil, ID: VXLANRsrcValidInitID},
@@ -146,7 +146,7 @@ var vxlanRsrcValidationStateMap = map[string]*vxlanRsrcValidator{
146146
},
147147
},
148148
},
149-
VXLANRsrcValidDeinitID: &vxlanRsrcValidator{
149+
VXLANRsrcValidDeinitID: {
150150
expCfg: []AutoVXLANCfgResource{
151151
{
152152
CommonState: core.CommonState{StateDriver: nil, ID: VXLANRsrcValidDeinitID},
@@ -167,7 +167,7 @@ var vxlanRsrcValidationStateMap = map[string]*vxlanRsrcValidator{
167167
},
168168
},
169169
},
170-
VXLANRsrcAllocateID: &vxlanRsrcValidator{
170+
VXLANRsrcAllocateID: {
171171
expCfg: []AutoVXLANCfgResource{
172172
{
173173
CommonState: core.CommonState{StateDriver: nil, ID: VXLANRsrcAllocateID},
@@ -193,7 +193,7 @@ var vxlanRsrcValidationStateMap = map[string]*vxlanRsrcValidator{
193193
},
194194
},
195195
},
196-
VXLANRsrcAllocateExhaustVXLANID: &vxlanRsrcValidator{
196+
VXLANRsrcAllocateExhaustVXLANID: {
197197
expCfg: []AutoVXLANCfgResource{
198198
{
199199
CommonState: core.CommonState{StateDriver: nil, ID: VXLANRsrcAllocateExhaustVXLANID},
@@ -214,7 +214,7 @@ var vxlanRsrcValidationStateMap = map[string]*vxlanRsrcValidator{
214214
},
215215
},
216216
},
217-
VXLANRsrcAllocateExhaustVLANID: &vxlanRsrcValidator{
217+
VXLANRsrcAllocateExhaustVLANID: {
218218
expCfg: []AutoVXLANCfgResource{
219219
{
220220
CommonState: core.CommonState{StateDriver: nil, ID: VXLANRsrcAllocateExhaustVLANID},
@@ -235,7 +235,7 @@ var vxlanRsrcValidationStateMap = map[string]*vxlanRsrcValidator{
235235
},
236236
},
237237
},
238-
VXLANRsrcDeallocateID: &vxlanRsrcValidator{
238+
VXLANRsrcDeallocateID: {
239239
expCfg: []AutoVXLANCfgResource{
240240
{
241241
CommonState: core.CommonState{StateDriver: nil, ID: VXLANRsrcDeallocateID},
@@ -271,7 +271,7 @@ var vxlanRsrcValidationStateMap = map[string]*vxlanRsrcValidator{
271271
},
272272
},
273273
},
274-
VXLANRsrcGetListID: &vxlanRsrcValidator{
274+
VXLANRsrcGetListID: {
275275
expCfg: []AutoVXLANCfgResource{
276276
{
277277
CommonState: core.CommonState{StateDriver: nil, ID: VXLANRsrcGetListID},

utils/driverfactory.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -17,28 +17,28 @@ type driverConfigTypes struct {
1717
}
1818

1919
var networkDriverRegistry = map[string]driverConfigTypes{
20-
OvsNameStr: driverConfigTypes{
20+
OvsNameStr: {
2121
DriverType: reflect.TypeOf(drivers.OvsDriver{}),
2222
ConfigType: reflect.TypeOf(drivers.OvsDriver{}),
2323
},
2424
// fakedriver is used for tests, so not exposing a public name for it.
25-
"fakedriver": driverConfigTypes{
25+
"fakedriver": {
2626
DriverType: reflect.TypeOf(drivers.FakeNetEpDriver{}),
2727
ConfigType: reflect.TypeOf(drivers.FakeNetEpDriverConfig{}),
2828
},
2929
}
3030

3131
var stateDriverRegistry = map[string]driverConfigTypes{
32-
EtcdNameStr: driverConfigTypes{
32+
EtcdNameStr: {
3333
DriverType: reflect.TypeOf(state.EtcdStateDriver{}),
3434
ConfigType: reflect.TypeOf(state.EtcdStateDriverConfig{}),
3535
},
36-
ConsulNameStr: driverConfigTypes{
36+
ConsulNameStr: {
3737
DriverType: reflect.TypeOf(state.ConsulStateDriver{}),
3838
ConfigType: reflect.TypeOf(state.ConsulStateDriverConfig{}),
3939
},
4040
// fakestate-driver is used for tests, so not exposing a public name for it.
41-
"fakedriver": driverConfigTypes{
41+
"fakedriver": {
4242
DriverType: reflect.TypeOf(state.FakeStateDriver{}),
4343
ConfigType: reflect.TypeOf(state.FakeStateDriverConfig{}),
4444
},

0 commit comments

Comments
 (0)