Skip to content

Commit 1138b68

Browse files
committed
Product of a 'make simplify' run.
make simplify in the project Makefile calls `gofmt -l -w -s .`, which cleans up code that is more complicated than necessary. This PR is just the result of running that command in the project Makefile.
1 parent eb3d70a commit 1138b68

Some content is hidden

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

71 files changed

+208
-208
lines changed

agent/tools/tools_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ var unpackToolsBadDataTests = []badDataTest{
7575
initBadDataTest("bar", os.ModeDir, "", "bad file type.*"),
7676
initBadDataTest("../../etc/passwd", agenttools.DirPerm, "", "bad name.*"),
7777
initBadDataTest(`\ini.sys`, agenttools.DirPerm, "", "bad name.*"),
78-
badDataTest{[]byte("x"), "2d711642b726b04401627ca9fbac32f5c8530fb1903cc4db02258717921a4881", "unexpected EOF"},
79-
badDataTest{gzyesses, "8d900c68a1a847aae4e95edcb29fcecd142c9b88ca4fe63209c216edbed546e1", "archive/tar: invalid tar header"},
78+
{[]byte("x"), "2d711642b726b04401627ca9fbac32f5c8530fb1903cc4db02258717921a4881", "unexpected EOF"},
79+
{gzyesses, "8d900c68a1a847aae4e95edcb29fcecd142c9b88ca4fe63209c216edbed546e1", "archive/tar: invalid tar header"},
8080
}
8181

8282
func (t *ToolsSuite) TestUnpackToolsBadData(c *gc.C) {

api/action/client_test.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,15 @@ func (s *actionSuite) TestServiceCharmActions(c *gc.C) {
3737
}{{
3838
description: "result from wrong service",
3939
patchResults: []params.ServiceCharmActionsResult{
40-
params.ServiceCharmActionsResult{
40+
{
4141
ServiceTag: names.NewServiceTag("bar").String(),
4242
},
4343
},
4444
expectedErr: `action results received for wrong service "service-bar"`,
4545
}, {
4646
description: "some other error",
4747
patchResults: []params.ServiceCharmActionsResult{
48-
params.ServiceCharmActionsResult{
48+
{
4949
ServiceTag: names.NewServiceTag("foo").String(),
5050
Error: &params.Error{
5151
Message: "something bad",
@@ -56,8 +56,8 @@ func (s *actionSuite) TestServiceCharmActions(c *gc.C) {
5656
}, {
5757
description: "more than one result",
5858
patchResults: []params.ServiceCharmActionsResult{
59-
params.ServiceCharmActionsResult{},
60-
params.ServiceCharmActionsResult{},
59+
{},
60+
{},
6161
},
6262
expectedErr: "2 results, expected 1",
6363
}, {
@@ -71,11 +71,11 @@ func (s *actionSuite) TestServiceCharmActions(c *gc.C) {
7171
}, {
7272
description: "normal result",
7373
patchResults: []params.ServiceCharmActionsResult{
74-
params.ServiceCharmActionsResult{
74+
{
7575
ServiceTag: names.NewServiceTag("foo").String(),
7676
Actions: &charm.Actions{
7777
ActionSpecs: map[string]charm.ActionSpec{
78-
"action": charm.ActionSpec{
78+
"action": {
7979
Description: "description",
8080
Params: map[string]interface{}{
8181
"foo": "bar",
@@ -87,7 +87,7 @@ func (s *actionSuite) TestServiceCharmActions(c *gc.C) {
8787
},
8888
expectedResult: &charm.Actions{
8989
ActionSpecs: map[string]charm.ActionSpec{
90-
"action": charm.ActionSpec{
90+
"action": {
9191
Description: "description",
9292
Params: map[string]interface{}{
9393
"foo": "bar",

api/facadeversions_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ func (s *facadeVersionSuite) TestFacadeVersionsMatchServerVersions(c *gc.C) {
2929
// code just to list out what versions are available. However, we do
3030
// want to make sure that the two sides are kept in sync.
3131
clientFacadeNames := set.NewStrings()
32-
for name, _ := range *api.FacadeVersions {
32+
for name := range *api.FacadeVersions {
3333
clientFacadeNames.Add(name)
3434
}
3535
allServerFacades := common.Facades.List()
@@ -84,7 +84,7 @@ func (s *facadeVersionSuite) TestBestFacadeVersionExactMatch(c *gc.C) {
8484
s.PatchValue(api.FacadeVersions, map[string]int{"Client": 1})
8585
st := api.NewTestingState(api.TestingStateParams{
8686
FacadeVersions: map[string][]int{
87-
"Client": []int{0, 1},
87+
"Client": {0, 1},
8888
}})
8989
c.Check(st.BestFacadeVersion("Client"), gc.Equals, 1)
9090
}
@@ -93,7 +93,7 @@ func (s *facadeVersionSuite) TestBestFacadeVersionNewerServer(c *gc.C) {
9393
s.PatchValue(api.FacadeVersions, map[string]int{"Client": 1})
9494
st := api.NewTestingState(api.TestingStateParams{
9595
FacadeVersions: map[string][]int{
96-
"Client": []int{0, 1, 2},
96+
"Client": {0, 1, 2},
9797
}})
9898
c.Check(st.BestFacadeVersion("Client"), gc.Equals, 1)
9999
}
@@ -102,7 +102,7 @@ func (s *facadeVersionSuite) TestBestFacadeVersionNewerClient(c *gc.C) {
102102
s.PatchValue(api.FacadeVersions, map[string]int{"Client": 2})
103103
st := api.NewTestingState(api.TestingStateParams{
104104
FacadeVersions: map[string][]int{
105-
"Client": []int{0, 1},
105+
"Client": {0, 1},
106106
}})
107107
c.Check(st.BestFacadeVersion("Client"), gc.Equals, 1)
108108
}
@@ -111,7 +111,7 @@ func (s *facadeVersionSuite) TestBestFacadeVersionServerUnknown(c *gc.C) {
111111
s.PatchValue(api.FacadeVersions, map[string]int{"TestingAPI": 2})
112112
st := api.NewTestingState(api.TestingStateParams{
113113
FacadeVersions: map[string][]int{
114-
"Client": []int{0, 1},
114+
"Client": {0, 1},
115115
}})
116116
c.Check(st.BestFacadeVersion("TestingAPI"), gc.Equals, 0)
117117
}

api/leadership/client_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ func (s *clientSuite) TestClaimLeadershipTranslation(c *gc.C) {
5858

5959
typedR, ok := response.(*params.ClaimLeadershipBulkResults)
6060
c.Assert(ok, gc.Equals, true)
61-
typedR.Results = []params.ClaimLeadershipResults{params.ClaimLeadershipResults{
61+
typedR.Results = []params.ClaimLeadershipResults{{
6262
ClaimDurationInSec: claimTime.Seconds(),
6363
}}
6464

@@ -88,7 +88,7 @@ func (s *clientSuite) TestClaimLeadershipErrorTranslation(c *gc.C) {
8888
numStubCalls++
8989
typedR, ok := response.(*params.ClaimLeadershipBulkResults)
9090
c.Assert(ok, gc.Equals, true)
91-
typedR.Results = []params.ClaimLeadershipResults{params.ClaimLeadershipResults{
91+
typedR.Results = []params.ClaimLeadershipResults{{
9292
Error: &params.Error{Message: errMsg},
9393
}}
9494
return nil

api/provisioner/provisioner_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ func (s *provisionerSuite) TestSetInstanceInfo(c *gc.C) {
301301
c.Assert(instanceId, gc.Equals, instance.Id("i-manager"))
302302

303303
// Check the networks are created.
304-
for i, _ := range networks {
304+
for i := range networks {
305305
if i == 3 {
306306
// Last one was ignored, so skip it.
307307
break

api/uniter/state_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,9 @@ func (s *stateSuite) TestAllMachinePortsV1(c *gc.C) {
7777
portsMap, err := s.uniter.AllMachinePorts(s.wordpressMachine.Tag().(names.MachineTag))
7878
c.Assert(err, jc.ErrorIsNil)
7979
c.Assert(portsMap, jc.DeepEquals, map[network.PortRange]params.RelationUnit{
80-
network.PortRange{100, 200, "tcp"}: params.RelationUnit{Unit: s.wordpressUnit.Tag().String()},
81-
network.PortRange{10, 20, "udp"}: params.RelationUnit{Unit: s.wordpressUnit.Tag().String()},
82-
network.PortRange{201, 250, "tcp"}: params.RelationUnit{Unit: wordpressUnit1.Tag().String()},
83-
network.PortRange{1, 8, "udp"}: params.RelationUnit{Unit: wordpressUnit1.Tag().String()},
80+
network.PortRange{100, 200, "tcp"}: {Unit: s.wordpressUnit.Tag().String()},
81+
network.PortRange{10, 20, "udp"}: {Unit: s.wordpressUnit.Tag().String()},
82+
network.PortRange{201, 250, "tcp"}: {Unit: wordpressUnit1.Tag().String()},
83+
network.PortRange{1, 8, "udp"}: {Unit: wordpressUnit1.Tag().String()},
8484
})
8585
}

apiserver/action/action_test.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -576,7 +576,7 @@ func (s *actionSuite) TestCancel(c *gc.C) {
576576

577577
func (s *actionSuite) TestServicesCharmActions(c *gc.C) {
578578
actionSchemas := map[string]map[string]interface{}{
579-
"snapshot": map[string]interface{}{
579+
"snapshot": {
580580
"type": "object",
581581
"title": "snapshot",
582582
"description": "Take a snapshot of the database.",
@@ -588,7 +588,7 @@ func (s *actionSuite) TestServicesCharmActions(c *gc.C) {
588588
},
589589
},
590590
},
591-
"fakeaction": map[string]interface{}{
591+
"fakeaction": {
592592
"type": "object",
593593
"title": "fakeaction",
594594
"description": "No description",
@@ -602,11 +602,11 @@ func (s *actionSuite) TestServicesCharmActions(c *gc.C) {
602602
serviceNames: []string{"dummy"},
603603
expectedResults: params.ServicesCharmActionsResults{
604604
Results: []params.ServiceCharmActionsResult{
605-
params.ServiceCharmActionsResult{
605+
{
606606
ServiceTag: names.NewServiceTag("dummy").String(),
607607
Actions: &charm.Actions{
608608
ActionSpecs: map[string]charm.ActionSpec{
609-
"snapshot": charm.ActionSpec{
609+
"snapshot": {
610610
Description: "Take a snapshot of the database.",
611611
Params: actionSchemas["snapshot"],
612612
},
@@ -619,11 +619,11 @@ func (s *actionSuite) TestServicesCharmActions(c *gc.C) {
619619
serviceNames: []string{"wordpress"},
620620
expectedResults: params.ServicesCharmActionsResults{
621621
Results: []params.ServiceCharmActionsResult{
622-
params.ServiceCharmActionsResult{
622+
{
623623
ServiceTag: names.NewServiceTag("wordpress").String(),
624624
Actions: &charm.Actions{
625625
ActionSpecs: map[string]charm.ActionSpec{
626-
"fakeaction": charm.ActionSpec{
626+
"fakeaction": {
627627
Description: "No description",
628628
Params: actionSchemas["fakeaction"],
629629
},
@@ -636,7 +636,7 @@ func (s *actionSuite) TestServicesCharmActions(c *gc.C) {
636636
serviceNames: []string{"nonsense"},
637637
expectedResults: params.ServicesCharmActionsResults{
638638
Results: []params.ServiceCharmActionsResult{
639-
params.ServiceCharmActionsResult{
639+
{
640640
ServiceTag: names.NewServiceTag("nonsense").String(),
641641
Error: &params.Error{
642642
Message: `service "nonsense" not found`,

apiserver/admin_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ func (s *loginSuite) TestLoginAddrs(c *gc.C) {
267267
connectedAddrPort, err := strconv.Atoi(connectedAddrPortString)
268268
c.Assert(err, jc.ErrorIsNil)
269269
connectedAddrHostPorts := [][]network.HostPort{
270-
[]network.HostPort{{
270+
{{
271271
network.NewAddress(connectedAddrHost, network.ScopeUnknown),
272272
connectedAddrPort,
273273
}},

apiserver/annotations/client_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ func (s *annotationSuite) TestServiceAnnotations(c *gc.C) {
7878

7979
func (s *annotationSuite) assertAnnotationsRemoval(c *gc.C, tag names.Tag) {
8080
entity := tag.String()
81-
entities := params.Entities{[]params.Entity{params.Entity{entity}}}
81+
entities := params.Entities{[]params.Entity{{entity}}}
8282
ann := s.annotationsApi.Get(entities)
8383
c.Assert(ann.Results, gc.HasLen, 1)
8484

@@ -89,7 +89,7 @@ func (s *annotationSuite) assertAnnotationsRemoval(c *gc.C, tag names.Tag) {
8989

9090
func (s *annotationSuite) TestInvalidEntityAnnotations(c *gc.C) {
9191
entity := "charm-invalid"
92-
entities := params.Entities{[]params.Entity{params.Entity{entity}}}
92+
entities := params.Entities{[]params.Entity{{entity}}}
9393
annotations := map[string]string{"mykey": "myvalue"}
9494

9595
setResult := s.annotationsApi.Set(
@@ -211,8 +211,8 @@ func (s *annotationSuite) TestMultipleEntitiesAnnotations(c *gc.C) {
211211
c.Assert(oneError, gc.Matches, ".*does not support annotations.*")
212212

213213
got := s.annotationsApi.Get(params.Entities{[]params.Entity{
214-
params.Entity{rEntity},
215-
params.Entity{sEntity}}})
214+
{rEntity},
215+
{sEntity}}})
216216
c.Assert(got.Results, gc.HasLen, 2)
217217

218218
var rGet, sGet bool
@@ -241,7 +241,7 @@ func (s *annotationSuite) testSetGetEntitiesAnnotations(c *gc.C, tag names.Tag)
241241
if t.err != "" {
242242
continue
243243
}
244-
aResult := s.assertGetEntityAnnotations(c, params.Entities{[]params.Entity{params.Entity{entity}}}, entity, t.expected)
244+
aResult := s.assertGetEntityAnnotations(c, params.Entities{[]params.Entity{{entity}}}, entity, t.expected)
245245
s.cleanupEntityAnnotations(c, entities, aResult)
246246
}
247247
}

apiserver/charms/client_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ func (s *baseCharmsSuite) TestClientCharmInfo(c *gc.C) {
5555
url: "local:quantal/dummy-1",
5656
expectedActions: &charm.Actions{
5757
ActionSpecs: map[string]charm.ActionSpec{
58-
"snapshot": charm.ActionSpec{
58+
"snapshot": {
5959
Description: "Take a snapshot of the database.",
6060
Params: map[string]interface{}{
6161
"type": "object",
@@ -78,7 +78,7 @@ func (s *baseCharmsSuite) TestClientCharmInfo(c *gc.C) {
7878
// Use wordpress for tests so that we can compare Provides and Requires.
7979
charm: "wordpress",
8080
expectedActions: &charm.Actions{ActionSpecs: map[string]charm.ActionSpec{
81-
"fakeaction": charm.ActionSpec{
81+
"fakeaction": {
8282
Description: "No description",
8383
Params: map[string]interface{}{
8484
"type": "object",

apiserver/client/api_test.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -196,27 +196,27 @@ var scenarioStatus = &api.Status{
196196
},
197197
},
198198
Services: map[string]api.ServiceStatus{
199-
"logging": api.ServiceStatus{
199+
"logging": {
200200
Charm: "local:quantal/logging-1",
201201
Relations: map[string][]string{
202-
"logging-directory": []string{"wordpress"},
202+
"logging-directory": {"wordpress"},
203203
},
204204
SubordinateTo: []string{"wordpress"},
205205
},
206-
"mysql": api.ServiceStatus{
206+
"mysql": {
207207
Charm: "local:quantal/mysql-1",
208208
Relations: map[string][]string{},
209209
SubordinateTo: []string{},
210210
Units: map[string]api.UnitStatus{},
211211
},
212-
"wordpress": api.ServiceStatus{
212+
"wordpress": {
213213
Charm: "local:quantal/wordpress-3",
214214
Relations: map[string][]string{
215-
"logging-dir": []string{"logging"},
215+
"logging-dir": {"logging"},
216216
},
217217
SubordinateTo: []string{},
218218
Units: map[string]api.UnitStatus{
219-
"wordpress/0": api.UnitStatus{
219+
"wordpress/0": {
220220
Agent: api.AgentStatus{
221221
Status: "error",
222222
Info: "blam",
@@ -226,7 +226,7 @@ var scenarioStatus = &api.Status{
226226
AgentStateInfo: "(error: blam)",
227227
Machine: "1",
228228
Subordinates: map[string]api.UnitStatus{
229-
"logging/0": api.UnitStatus{
229+
"logging/0": {
230230
Agent: api.AgentStatus{
231231
Status: "allocating",
232232
Data: make(map[string]interface{}),
@@ -235,15 +235,15 @@ var scenarioStatus = &api.Status{
235235
},
236236
},
237237
},
238-
"wordpress/1": api.UnitStatus{
238+
"wordpress/1": {
239239
Agent: api.AgentStatus{
240240
Status: "allocating",
241241
Data: make(map[string]interface{}),
242242
},
243243
AgentState: "allocating",
244244
Machine: "2",
245245
Subordinates: map[string]api.UnitStatus{
246-
"logging/1": api.UnitStatus{
246+
"logging/1": {
247247
Agent: api.AgentStatus{
248248
Status: "allocating",
249249
Data: make(map[string]interface{}),
@@ -256,17 +256,17 @@ var scenarioStatus = &api.Status{
256256
},
257257
},
258258
Relations: []api.RelationStatus{
259-
api.RelationStatus{
259+
{
260260
Id: 0,
261261
Key: "logging:logging-directory wordpress:logging-dir",
262262
Endpoints: []api.EndpointStatus{
263-
api.EndpointStatus{
263+
{
264264
ServiceName: "logging",
265265
Name: "logging-directory",
266266
Role: "requirer",
267267
Subordinate: true,
268268
},
269-
api.EndpointStatus{
269+
{
270270
ServiceName: "wordpress",
271271
Name: "logging-dir",
272272
Role: "provider",

apiserver/client/client_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -802,7 +802,7 @@ func (s *clientSuite) TestClientCharmInfo(c *gc.C) {
802802
url: "local:quantal/dummy-1",
803803
expectedActions: &charm.Actions{
804804
ActionSpecs: map[string]charm.ActionSpec{
805-
"snapshot": charm.ActionSpec{
805+
"snapshot": {
806806
Description: "Take a snapshot of the database.",
807807
Params: map[string]interface{}{
808808
"type": "object",
@@ -825,7 +825,7 @@ func (s *clientSuite) TestClientCharmInfo(c *gc.C) {
825825
// Use wordpress for tests so that we can compare Provides and Requires.
826826
charm: "wordpress",
827827
expectedActions: &charm.Actions{ActionSpecs: map[string]charm.ActionSpec{
828-
"fakeaction": charm.ActionSpec{
828+
"fakeaction": {
829829
Description: "No description",
830830
Params: map[string]interface{}{
831831
"type": "object",
@@ -1439,7 +1439,7 @@ func (s *clientSuite) testClientServiceDeployWithStorage(c *gc.C, expectConstrai
14391439
s.makeMockCharmStore()
14401440
curl, bundle := addCharm(c, "storage-block")
14411441
storageConstraints := map[string]storage.Constraints{
1442-
"data": storage.Constraints{
1442+
"data": {
14431443
Count: 1,
14441444
Size: 1024,
14451445
},
@@ -1457,7 +1457,7 @@ func (s *clientSuite) testClientServiceDeployWithStorage(c *gc.C, expectConstrai
14571457

14581458
if expectConstraints {
14591459
c.Assert(storageConstraintsOut, gc.DeepEquals, map[string]state.StorageConstraints{
1460-
"data": state.StorageConstraints{
1460+
"data": {
14611461
Count: 1,
14621462
Size: 1024,
14631463
},

apiserver/client/perm_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ func opClientCharmInfo(c *gc.C, st *api.State, mst *state.State) (func(), error)
200200
c.Assert(info.Revision, gc.Equals, 3)
201201
c.Assert(info.Actions, jc.DeepEquals, &charm.Actions{
202202
ActionSpecs: map[string]charm.ActionSpec{
203-
"fakeaction": charm.ActionSpec{
203+
"fakeaction": {
204204
Description: "No description",
205205
Params: map[string]interface{}{
206206
"type": "object",

0 commit comments

Comments
 (0)