Skip to content

Commit 3342827

Browse files
Gofmt static analysis linter
The following changes introduce the gofmt linter. Most of the code changes are the consequence of getting the linter to pass. Using the `make simplify` command does this automatically for you.
1 parent 0879177 commit 3342827

File tree

181 files changed

+1078
-1079
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

181 files changed

+1078
-1079
lines changed

api/application/client_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ func (s *applicationSuite) TestDeploy(c *gc.C) {
9696
c.Assert(app.Constraints, gc.DeepEquals, constraints.MustParse("mem=4G"))
9797
c.Assert(app.Placement, gc.DeepEquals, []*instance.Placement{{"scope", "directive"}})
9898
c.Assert(app.EndpointBindings, gc.DeepEquals, map[string]string{"foo": "bar"})
99-
c.Assert(app.Storage, gc.DeepEquals, map[string]storage.Constraints{"data": storage.Constraints{Pool: "pool"}})
99+
c.Assert(app.Storage, gc.DeepEquals, map[string]storage.Constraints{"data": {Pool: "pool"}})
100100
c.Assert(app.AttachStorage, gc.DeepEquals, []string{"storage-data-0"})
101101
c.Assert(app.Resources, gc.DeepEquals, map[string]string{"foo": "bar"})
102102

@@ -119,7 +119,7 @@ func (s *applicationSuite) TestDeploy(c *gc.C) {
119119
Config: map[string]string{"foo": "bar"},
120120
Cons: constraints.MustParse("mem=4G"),
121121
Placement: []*instance.Placement{{"scope", "directive"}},
122-
Storage: map[string]storage.Constraints{"data": storage.Constraints{Pool: "pool"}},
122+
Storage: map[string]storage.Constraints{"data": {Pool: "pool"}},
123123
AttachStorage: []string{"data/0"},
124124
Resources: map[string]string{"foo": "bar"},
125125
EndpointBindings: map[string]string{"foo": "bar"},

api/common/network_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -965,7 +965,7 @@ func (s *NetworkSuite) TestGetObservedNetworkConfigLoopbackInfrerred(c *gc.C) {
965965
func (s *NetworkSuite) TestGetObservedNetworkConfigVLANInfrerred(c *gc.C) {
966966
s.stubConfigSource.interfaces = exampleObservedInterfaces[6:7] // only eth0.100
967967
s.stubConfigSource.interfaceAddrs = map[string][]net.Addr{
968-
"eth0.100": []net.Addr{
968+
"eth0.100": {
969969
fakeAddr("fe80::5054:ff:fedd:eef0:100/64"),
970970
fakeAddr("10.100.19.123/24"),
971971
},
@@ -1108,7 +1108,7 @@ func (s *NetworkSuite) TestGetObservedNetworkConfigAddressNotInCIDRFormat(c *gc.
11081108
// Simulate running on Windows, where net.InterfaceAddrs() returns
11091109
// non-CIDR-formatted addresses.
11101110
s.stubConfigSource.interfaceAddrs = map[string][]net.Addr{
1111-
"eth0": []net.Addr{fakeAddr("10.20.19.42")},
1111+
"eth0": {fakeAddr("10.20.19.42")},
11121112
}
11131113

11141114
observedConfig, err := common.GetObservedNetworkConfig(s.stubConfigSource)
@@ -1131,7 +1131,7 @@ func (s *NetworkSuite) TestGetObservedNetworkConfigEmptyAddressValue(c *gc.C) {
11311131
s.stubConfigSource.interfaces = exampleObservedInterfaces[1:2] // only eth0
11321132
s.stubConfigSource.makeSysClassNetInterfacePath(c, "eth0", "")
11331133
s.stubConfigSource.interfaceAddrs = map[string][]net.Addr{
1134-
"eth0": []net.Addr{fakeAddr("")},
1134+
"eth0": {fakeAddr("")},
11351135
}
11361136

11371137
observedConfig, err := common.GetObservedNetworkConfig(s.stubConfigSource)
@@ -1153,7 +1153,7 @@ func (s *NetworkSuite) TestGetObservedNetworkConfigInvalidAddressValue(c *gc.C)
11531153
s.stubConfigSource.interfaces = exampleObservedInterfaces[1:2] // only eth0
11541154
s.stubConfigSource.makeSysClassNetInterfacePath(c, "eth0", "")
11551155
s.stubConfigSource.interfaceAddrs = map[string][]net.Addr{
1156-
"eth0": []net.Addr{fakeAddr("invalid")},
1156+
"eth0": {fakeAddr("invalid")},
11571157
}
11581158

11591159
observedConfig, err := common.GetObservedNetworkConfig(s.stubConfigSource)

api/controller/controller_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ func (s *Suite) TestModelStatus(c *gc.C) {
307307

308308
out := result.(*params.ModelStatusResults)
309309
out.Results = []params.ModelStatus{
310-
params.ModelStatus{
310+
{
311311
ModelTag: coretesting.ModelTag.String(),
312312
OwnerTag: "user-glenda",
313313
ApplicationCount: 3,
@@ -319,7 +319,7 @@ func (s *Suite) TestModelStatus(c *gc.C) {
319319
Status: "pending",
320320
}},
321321
},
322-
params.ModelStatus{Error: common.ServerError(errors.New("model error"))},
322+
{Error: common.ServerError(errors.New("model error"))},
323323
}
324324
return nil
325325
},

api/firewaller/machine_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ func (s *machineSuite) TestOpenedPorts(c *gc.C) {
131131
ports, err = s.apiMachine.OpenedPorts(names.SubnetTag{})
132132
c.Assert(err, jc.ErrorIsNil)
133133
c.Assert(ports, jc.DeepEquals, map[network.PortRange]names.UnitTag{
134-
network.PortRange{FromPort: 1234, ToPort: 1234, Protocol: "tcp"}: unitTag,
134+
{FromPort: 1234, ToPort: 1234, Protocol: "tcp"}: unitTag,
135135
})
136136
}
137137

api/imagemetadatamanager/client_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ func (s *imagemetadataSuite) TestList(c *gc.C) {
5757

5858
if results, k := result.(*params.ListCloudImageMetadataResult); k {
5959
instances := []params.CloudImageMetadata{
60-
params.CloudImageMetadata{
60+
{
6161
ImageId: imageId,
6262
Stream: args.Stream,
6363
Region: args.Region,
@@ -85,7 +85,7 @@ func (s *imagemetadataSuite) TestList(c *gc.C) {
8585

8686
c.Assert(called, jc.IsTrue)
8787
expected := []params.CloudImageMetadata{
88-
params.CloudImageMetadata{
88+
{
8989
ImageId: imageId,
9090
Stream: stream,
9191
Region: region,

api/migrationmaster/client_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ func (s *ClientSuite) TestExport(c *gc.C) {
261261
Username: "xena",
262262
},
263263
UnitRevisions: map[string]params.SerializedModelResourceRevision{
264-
"fooapp/0": params.SerializedModelResourceRevision{
264+
"fooapp/0": {
265265
Revision: 1,
266266
Type: "file",
267267
Path: "blink.tar.gz",
@@ -323,7 +323,7 @@ func (s *ClientSuite) TestExport(c *gc.C) {
323323
Username: "xena",
324324
},
325325
UnitRevisions: map[string]resource.Resource{
326-
"fooapp/0": resource.Resource{
326+
"fooapp/0": {
327327
Resource: charmresource.Resource{
328328
Meta: charmresource.Meta{
329329
Name: "bin",

api/modelmanager/modelmanager_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ func (s *modelmanagerSuite) TestModelStatus(c *gc.C) {
352352

353353
out := result.(*params.ModelStatusResults)
354354
out.Results = []params.ModelStatus{
355-
params.ModelStatus{
355+
{
356356
ModelTag: coretesting.ModelTag.String(),
357357
OwnerTag: "user-glenda",
358358
ApplicationCount: 3,
@@ -364,7 +364,7 @@ func (s *modelmanagerSuite) TestModelStatus(c *gc.C) {
364364
Status: "pending",
365365
}},
366366
},
367-
params.ModelStatus{Error: common.ServerError(errors.New("model error"))},
367+
{Error: common.ServerError(errors.New("model error"))},
368368
}
369369
return nil
370370
},

api/provisioner/provisioner_test.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,7 @@ func (s *provisionerSuite) TestDistributionGroupByMachineId(c *gc.C) {
437437
c.Assert(err, jc.ErrorIsNil)
438438
c.Assert(len(results), gc.Equals, 1)
439439
c.Assert(results, gc.DeepEquals, []provisioner.DistributionGroupResult{
440-
provisioner.DistributionGroupResult{MachineIds: nil, Err: nil},
440+
{MachineIds: nil, Err: nil},
441441
})
442442

443443
machine1, err := s.State.AddMachine("quantal", state.JobHostUnits)
@@ -455,8 +455,8 @@ func (s *provisionerSuite) TestDistributionGroupByMachineId(c *gc.C) {
455455
c.Assert(err, jc.ErrorIsNil)
456456
c.Assert(len(results), gc.Equals, 2)
457457
c.Assert(results, gc.DeepEquals, []provisioner.DistributionGroupResult{
458-
provisioner.DistributionGroupResult{MachineIds: nil, Err: nil},
459-
provisioner.DistributionGroupResult{MachineIds: nil, Err: nil},
458+
{MachineIds: nil, Err: nil},
459+
{MachineIds: nil, Err: nil},
460460
})
461461

462462
machine2, err := s.State.AddMachine("quantal", state.JobHostUnits)
@@ -474,9 +474,9 @@ func (s *provisionerSuite) TestDistributionGroupByMachineId(c *gc.C) {
474474
c.Assert(err, jc.ErrorIsNil)
475475
c.Assert(len(results), gc.Equals, 3)
476476
c.Assert(results, gc.DeepEquals, []provisioner.DistributionGroupResult{
477-
provisioner.DistributionGroupResult{MachineIds: nil, Err: nil},
478-
provisioner.DistributionGroupResult{MachineIds: []string{"2"}, Err: nil},
479-
provisioner.DistributionGroupResult{MachineIds: []string{"1"}, Err: nil},
477+
{MachineIds: nil, Err: nil},
478+
{MachineIds: []string{"2"}, Err: nil},
479+
{MachineIds: []string{"1"}, Err: nil},
480480
})
481481
}
482482

@@ -527,8 +527,8 @@ func (s *provisionerSuite) TestProvisioningInfo(c *gc.C) {
527527
c.Assert(provisioningInfo.Placement, gc.Equals, template.Placement)
528528
c.Assert(provisioningInfo.Constraints, jc.DeepEquals, template.Constraints)
529529
c.Assert(provisioningInfo.SubnetsToZones, jc.DeepEquals, map[string][]string{
530-
"subnet-2": []string{"zone2"},
531-
"subnet-3": []string{"zone3"},
530+
"subnet-2": {"zone2"},
531+
"subnet-3": {"zone3"},
532532
})
533533
}
534534

api/proxyupdater/proxyupdater_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ func (s *ProxyUpdaterSuite) TestNilTagFails(c *gc.C) {
5656

5757
func (s *ProxyUpdaterSuite) TestWatchForProxyConfigAndAPIHostPortChanges(c *gc.C) {
5858
res := params.NotifyWatchResults{
59-
Results: []params.NotifyWatchResult{params.NotifyWatchResult{
59+
Results: []params.NotifyWatchResult{{
6060
NotifyWatcherId: "4242",
6161
}},
6262
}

api/spaces/spaces_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ func makeArgs(name string, subnets []string) (string, []string, apitesting.APICa
5656

5757
expectArgs := params.CreateSpacesParams{
5858
Spaces: []params.CreateSpaceParams{
59-
params.CreateSpaceParams{
59+
{
6060
SpaceTag: spaceTag,
6161
SubnetTags: subnetTags,
6262
Public: true,

0 commit comments

Comments
 (0)