Skip to content

Commit e14f208

Browse files
[FAB-7802] Automatic format fix using gofmt
gofmt -w -s Many developers have integrated `gofmt` auto-formatting. S Some code changes can automatically cause other changes caused through `gofmt` integration, not related to the intent of the task. For clarity in future pull-requests, the gofmt issues should be solved once and for all. This change doesn't break the code, because it uses official `gofmt` to do the auto code formatting. Change-Id: Ife1c2e112dc4f188fb6a90916587af453a133099 Signed-off-by: Robert Zaremba <robert.zaremba@scale-it.pl>
1 parent 2c8a82a commit e14f208

File tree

25 files changed

+68
-68
lines changed

25 files changed

+68
-68
lines changed

common/capabilities/application_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ func TestApplicationV10(t *testing.T) {
2121

2222
func TestApplicationV11(t *testing.T) {
2323
op := NewApplicationProvider(map[string]*cb.Capability{
24-
ApplicationV1_1: &cb.Capability{},
24+
ApplicationV1_1: {},
2525
})
2626
assert.NoError(t, op.Supported())
2727
assert.True(t, op.ForbidDuplicateTXIdInBlock())

common/capabilities/capabilities_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ func TestSatisfied(t *testing.T) {
3232

3333
func TestNotSatisfied(t *testing.T) {
3434
capsMap := map[string]*cb.Capability{
35-
"FakeCapability": &cb.Capability{},
35+
"FakeCapability": {},
3636
}
3737
for _, provider := range []*registry{
3838
NewChannelProvider(capsMap).registry,

common/capabilities/channel_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ func TestChannelV10(t *testing.T) {
2323

2424
func TestChannelV11(t *testing.T) {
2525
op := NewChannelProvider(map[string]*cb.Capability{
26-
ChannelV1_1: &cb.Capability{},
26+
ChannelV1_1: {},
2727
})
2828
assert.NoError(t, op.Supported())
2929
assert.True(t, op.MSPVersion() == msp.MSPv1_1)

common/capabilities/orderer_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ func TestOrdererV10(t *testing.T) {
2222

2323
func TestOrdererV11(t *testing.T) {
2424
op := NewOrdererProvider(map[string]*cb.Capability{
25-
OrdererV1_1: &cb.Capability{},
25+
OrdererV1_1: {},
2626
})
2727
assert.NoError(t, op.Supported())
2828
assert.True(t, op.SetChannelModPolicyDuringCreate())

common/channelconfig/bundle_test.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -221,10 +221,10 @@ func TestPrevalidation(t *testing.T) {
221221
err := preValidate(&cb.Config{
222222
ChannelGroup: &cb.ConfigGroup{
223223
Groups: map[string]*cb.ConfigGroup{
224-
OrdererGroupKey: &cb.ConfigGroup{},
224+
OrdererGroupKey: {},
225225
},
226226
Values: map[string]*cb.ConfigValue{
227-
CapabilitiesKey: &cb.ConfigValue{},
227+
CapabilitiesKey: {},
228228
},
229229
},
230230
})
@@ -237,12 +237,12 @@ func TestPrevalidation(t *testing.T) {
237237
err := preValidate(&cb.Config{
238238
ChannelGroup: &cb.ConfigGroup{
239239
Groups: map[string]*cb.ConfigGroup{
240-
ApplicationGroupKey: &cb.ConfigGroup{
240+
ApplicationGroupKey: {
241241
Values: map[string]*cb.ConfigValue{
242-
CapabilitiesKey: &cb.ConfigValue{},
242+
CapabilitiesKey: {},
243243
},
244244
},
245-
OrdererGroupKey: &cb.ConfigGroup{},
245+
OrdererGroupKey: {},
246246
},
247247
},
248248
})
@@ -255,19 +255,19 @@ func TestPrevalidation(t *testing.T) {
255255
err := preValidate(&cb.Config{
256256
ChannelGroup: &cb.ConfigGroup{
257257
Groups: map[string]*cb.ConfigGroup{
258-
ApplicationGroupKey: &cb.ConfigGroup{
258+
ApplicationGroupKey: {
259259
Values: map[string]*cb.ConfigValue{
260-
CapabilitiesKey: &cb.ConfigValue{},
260+
CapabilitiesKey: {},
261261
},
262262
},
263-
OrdererGroupKey: &cb.ConfigGroup{
263+
OrdererGroupKey: {
264264
Values: map[string]*cb.ConfigValue{
265-
CapabilitiesKey: &cb.ConfigValue{},
265+
CapabilitiesKey: {},
266266
},
267267
},
268268
},
269269
Values: map[string]*cb.ConfigValue{
270-
CapabilitiesKey: &cb.ConfigValue{},
270+
CapabilitiesKey: {},
271271
},
272272
},
273273
})

common/channelconfig/util_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,6 @@ func TestUtilsBasic(t *testing.T) {
4040
basicTest(t, KafkaBrokersValue([]string{"foo:1", "bar:2"}))
4141
basicTest(t, MSPValue(&mspprotos.MSPConfig{}))
4242
basicTest(t, CapabilitiesValue(map[string]bool{"foo": true, "bar": false}))
43-
basicTest(t, AnchorPeersValue([]*pb.AnchorPeer{&pb.AnchorPeer{}, &pb.AnchorPeer{}}))
43+
basicTest(t, AnchorPeersValue([]*pb.AnchorPeer{{}, {}}))
4444
basicTest(t, ChannelCreationPolicyValue(&cb.Policy{}))
4545
}

common/configtx/update_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ func TestPolicyForItem(t *testing.T) {
128128
pm: &mockpolicies.Manager{
129129
Policy: rootPolicy,
130130
SubManagersMap: map[string]*mockpolicies.Manager{
131-
"foo": &mockpolicies.Manager{
131+
"foo": {
132132
Policy: fooPolicy,
133133
},
134134
},

common/resourcesconfig/apis_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@ const (
2626

2727
var sampleAPIsGroup = &cb.ConfigGroup{
2828
Values: map[string]*cb.ConfigValue{
29-
sampleAPI1Name: &cb.ConfigValue{
29+
sampleAPI1Name: {
3030
Value: utils.MarshalOrPanic(&pb.APIResource{
3131
PolicyRef: sampleAPI1PolicyRef,
3232
}),
3333
},
34-
sampleAPI2Name: &cb.ConfigValue{
34+
sampleAPI2Name: {
3535
Value: utils.MarshalOrPanic(&pb.APIResource{
3636
PolicyRef: sampleAPI2PolicyRef,
3737
}),
@@ -57,7 +57,7 @@ func TestGreenAPIsPath(t *testing.T) {
5757
func TestBadSubgroupsAPIsGroup(t *testing.T) {
5858
ccg, err := newAPIsGroup(&cb.ConfigGroup{
5959
Groups: map[string]*cb.ConfigGroup{
60-
"subGroup": &cb.ConfigGroup{},
60+
"subGroup": {},
6161
},
6262
})
6363

common/resourcesconfig/bundle_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ func TestBundleFailure(t *testing.T) {
5151
Config: &cb.Config{
5252
ChannelGroup: &cb.ConfigGroup{
5353
Groups: map[string]*cb.ConfigGroup{
54-
"badsubgroup": &cb.ConfigGroup{},
54+
"badsubgroup": {},
5555
},
5656
},
5757
},

common/resourcesconfig/chaincode_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,19 +29,19 @@ var (
2929

3030
var sampleChaincodeGroup = &cb.ConfigGroup{
3131
Values: map[string]*cb.ConfigValue{
32-
"ChaincodeIdentifier": &cb.ConfigValue{
32+
"ChaincodeIdentifier": {
3333
Value: utils.MarshalOrPanic(&pb.ChaincodeIdentifier{
3434
Version: sampleChaincodeVersion,
3535
Hash: sampleChaincodeHash,
3636
}),
3737
},
38-
"ChaincodeValidation": &cb.ConfigValue{
38+
"ChaincodeValidation": {
3939
Value: utils.MarshalOrPanic(&pb.ChaincodeValidation{
4040
Name: sampleChaincodeValidationName,
4141
Argument: sampleChaincodeValidationArg,
4242
}),
4343
},
44-
"ChaincodeEndorsement": &cb.ConfigValue{
44+
"ChaincodeEndorsement": {
4545
Value: utils.MarshalOrPanic(&pb.ChaincodeEndorsement{
4646
Name: sampleChaincodeEndorsementName,
4747
}),
@@ -68,7 +68,7 @@ func TestGreenChaincodePath(t *testing.T) {
6868
func TestBadSubgroupsChaincodeGroup(t *testing.T) {
6969
ccg, err := newChaincodeGroup("bar", &cb.ConfigGroup{
7070
Groups: map[string]*cb.ConfigGroup{
71-
"subGroup": &cb.ConfigGroup{},
71+
"subGroup": {},
7272
},
7373
})
7474

common/resourcesconfig/chaincodes_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ func TestGreenChaincodesPath(t *testing.T) {
4343
func TestChaincodesWithValues(t *testing.T) {
4444
ccsg, err := newChaincodesGroup(&cb.ConfigGroup{
4545
Values: map[string]*cb.ConfigValue{
46-
"foo": &cb.ConfigValue{},
46+
"foo": {},
4747
},
4848
})
4949

common/resourcesconfig/peerpolicies_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ var (
3030
"bar": dummyPolicy,
3131
},
3232
Groups: map[string]*cb.ConfigGroup{
33-
"subGroup": &cb.ConfigGroup{
33+
"subGroup": {
3434
Policies: map[string]*cb.ConfigPolicy{
3535
"other": dummyPolicy,
3636
},
@@ -48,9 +48,9 @@ func TestGreenPeerPoliciesPath(t *testing.T) {
4848
func TestPeerPolicieesWithValues(t *testing.T) {
4949
_, err := newPeerPoliciesGroup(&cb.ConfigGroup{
5050
Groups: map[string]*cb.ConfigGroup{
51-
"bar": &cb.ConfigGroup{
51+
"bar": {
5252
Values: map[string]*cb.ConfigValue{
53-
"foo": &cb.ConfigValue{},
53+
"foo": {},
5454
},
5555
},
5656
},

common/resourcesconfig/resources_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ func TestBadPathResourceGroup(t *testing.T) {
3737
t.Run("BadValues", func(t *testing.T) {
3838
rg, err := newResourceGroup(&cb.ConfigGroup{
3939
Values: map[string]*cb.ConfigValue{
40-
"foo": &cb.ConfigValue{},
40+
"foo": {},
4141
},
4242
})
4343
assert.Nil(t, rg)
@@ -48,7 +48,7 @@ func TestBadPathResourceGroup(t *testing.T) {
4848
t.Run("BadSubGroup", func(t *testing.T) {
4949
rg, err := newResourceGroup(&cb.ConfigGroup{
5050
Groups: map[string]*cb.ConfigGroup{
51-
"bar": &cb.ConfigGroup{},
51+
"bar": {},
5252
},
5353
})
5454
assert.Nil(t, rg)

common/tools/configtxgen/encoder/encoder.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -379,13 +379,13 @@ func NewChannelCreateConfigUpdate(channelID string, orderingSystemChannelGroup *
379379
Type: int32(cb.ConfigType_RESOURCE),
380380
ChannelGroup: &cb.ConfigGroup{
381381
Groups: map[string]*cb.ConfigGroup{
382-
resourcesconfig.ChaincodesGroupKey: &cb.ConfigGroup{
382+
resourcesconfig.ChaincodesGroupKey: {
383383
ModPolicy: defaultModPolicy,
384384
},
385-
resourcesconfig.PeerPoliciesGroupKey: &cb.ConfigGroup{
385+
resourcesconfig.PeerPoliciesGroupKey: {
386386
ModPolicy: defaultModPolicy,
387387
},
388-
resourcesconfig.APIsGroupKey: &cb.ConfigGroup{
388+
resourcesconfig.APIsGroupKey: {
389389
ModPolicy: defaultModPolicy,
390390
},
391391
},
@@ -415,7 +415,7 @@ func MakeChannelCreationTransaction(channelID string, signer crypto.LocalSigner,
415415
return nil, errors.Wrap(err, "creating signature header failed")
416416
}
417417

418-
newConfigUpdateEnv.Signatures = []*cb.ConfigSignature{&cb.ConfigSignature{
418+
newConfigUpdateEnv.Signatures = []*cb.ConfigSignature{{
419419
SignatureHeader: utils.MarshalOrPanic(sigHeader),
420420
}}
421421

common/tools/configtxgen/encoder/encoder_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -225,23 +225,23 @@ func TestNewChannelGroup(t *testing.T) {
225225

226226
t.Run("Add application unknown MSP", func(t *testing.T) {
227227
config := genesisconfig.Load(genesisconfig.SampleDevModeSoloProfile)
228-
config.Application = &genesisconfig.Application{Organizations: []*genesisconfig.Organization{&genesisconfig.Organization{Name: "FakeOrg"}}}
228+
config.Application = &genesisconfig.Application{Organizations: []*genesisconfig.Organization{{Name: "FakeOrg"}}}
229229
group, err := NewChannelGroup(config)
230230
assert.Error(t, err)
231231
assert.Nil(t, group)
232232
})
233233

234234
t.Run("Add consortiums unknown MSP", func(t *testing.T) {
235235
config := genesisconfig.Load(genesisconfig.SampleDevModeSoloProfile)
236-
config.Consortiums["fakeorg"] = &genesisconfig.Consortium{Organizations: []*genesisconfig.Organization{&genesisconfig.Organization{Name: "FakeOrg"}}}
236+
config.Consortiums["fakeorg"] = &genesisconfig.Consortium{Organizations: []*genesisconfig.Organization{{Name: "FakeOrg"}}}
237237
group, err := NewChannelGroup(config)
238238
assert.Error(t, err)
239239
assert.Nil(t, group)
240240
})
241241

242242
t.Run("Add orderer unknown MSP", func(t *testing.T) {
243243
config := genesisconfig.Load(genesisconfig.SampleDevModeSoloProfile)
244-
config.Orderer = &genesisconfig.Orderer{Organizations: []*genesisconfig.Organization{&genesisconfig.Organization{Name: "FakeOrg"}}}
244+
config.Orderer = &genesisconfig.Orderer{Organizations: []*genesisconfig.Organization{{Name: "FakeOrg"}}}
245245
group, err := NewChannelGroup(config)
246246
assert.Error(t, err)
247247
assert.Nil(t, group)

common/tools/protolator/blackbox_test.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -79,17 +79,17 @@ func TestResourcesConfig(t *testing.T) {
7979
Type: int32(cb.ConfigType_RESOURCE),
8080
ChannelGroup: &cb.ConfigGroup{
8181
Groups: map[string]*cb.ConfigGroup{
82-
"Chaincodes": &cb.ConfigGroup{
82+
"Chaincodes": {
8383
Groups: map[string]*cb.ConfigGroup{
84-
"cc1": &cb.ConfigGroup{
84+
"cc1": {
8585
Values: map[string]*cb.ConfigValue{
86-
"ChaincodeIdentifier": &cb.ConfigValue{
86+
"ChaincodeIdentifier": {
8787
Value: utils.MarshalOrPanic(&pb.ChaincodeIdentifier{
8888
Hash: []byte("somehashvalue"),
8989
Version: "aversionstring",
9090
}),
9191
},
92-
"ChaincodeValidation": &cb.ConfigValue{
92+
"ChaincodeValidation": {
9393
Value: utils.MarshalOrPanic(
9494
&pb.ChaincodeValidation{
9595
Name: "vscc",
@@ -98,7 +98,7 @@ func TestResourcesConfig(t *testing.T) {
9898
}),
9999
}),
100100
},
101-
"ChaincodeEndorsement": &cb.ConfigValue{
101+
"ChaincodeEndorsement": {
102102
Value: utils.MarshalOrPanic(&pb.ChaincodeEndorsement{
103103
Name: "escc",
104104
}),
@@ -107,17 +107,17 @@ func TestResourcesConfig(t *testing.T) {
107107
},
108108
},
109109
},
110-
"APIs": &cb.ConfigGroup{
110+
"APIs": {
111111
Values: map[string]*cb.ConfigValue{
112-
"Test": &cb.ConfigValue{
112+
"Test": {
113113
Value: utils.MarshalOrPanic(&pb.APIResource{PolicyRef: "Foo"}),
114114
},
115-
"Another": &cb.ConfigValue{
115+
"Another": {
116116
Value: utils.MarshalOrPanic(&pb.APIResource{PolicyRef: "Bar"}),
117117
},
118118
},
119119
},
120-
"PeerPolicies": &cb.ConfigGroup{},
120+
"PeerPolicies": {},
121121
},
122122
},
123123
}

core/handlers/library/registry_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ import (
1616

1717
func TestInitRegistry(t *testing.T) {
1818
r := InitRegistry(Config{
19-
AuthFilters: []*HandlerConfig{&HandlerConfig{Name: "DefaultAuth"}},
20-
Decorators: []*HandlerConfig{&HandlerConfig{Name: "DefaultDecorator"}},
19+
AuthFilters: []*HandlerConfig{{Name: "DefaultAuth"}},
20+
Decorators: []*HandlerConfig{{Name: "DefaultDecorator"}},
2121
})
2222
assert.NotNil(t, r)
2323
authHandlers := r.Lookup(Auth)

core/ledger/cceventmgmt/mgmt_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ func TestLSCCListener(t *testing.T) {
8181
sampleChaincodeDataBytes, err := proto.Marshal(sampleChaincodeData)
8282
assert.NoError(t, err, "")
8383
lsccStateListener.HandleStateUpdates(channelName, []*kvrwset.KVWrite{
84-
&kvrwset.KVWrite{Key: cc1Def.Name, Value: sampleChaincodeDataBytes},
84+
{Key: cc1Def.Name, Value: sampleChaincodeDataBytes},
8585
})
8686
assert.Contains(t, handler1.eventsRecieved, &mockEvent{cc1Def, cc1DBArtifactsTar})
8787
}

core/ledger/kvledger/state_listener_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ func TestStateListener(t *testing.T) {
8383
assert.NoError(t, lgr.CommitWithPvtData(&ledger.BlockAndPvtData{Block: blk3}))
8484
assert.Equal(t, channelid, mockListener.channelName)
8585
assert.Equal(t, []*kvrwset.KVWrite{
86-
&kvrwset.KVWrite{Key: "key4", Value: []byte("value4")},
86+
{Key: "key4", Value: []byte("value4")},
8787
}, mockListener.kvWrites)
8888
}
8989

core/ledger/kvledger/txmgmt/statedb/statecouchdb/statecouchdb.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -736,7 +736,7 @@ func (vdb *VersionedDB) LoadCommittedVersions(keys []*statedb.CompositeKey) erro
736736
// Call the batch retrieve if there is one or more keys to retrieve
737737
if len(missingKeys) > 0 {
738738

739-
for namespace, _ := range missingKeys {
739+
for namespace := range missingKeys {
740740
// TODO: For each namespace, we need to parallely load missing keys into the cache
741741
// The following codes need be moved to goroutine and introduce RWlock for cache.
742742

core/ledger/kvledger/txmgmt/validator/valimpl/helper_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ func TestPreprocessProtoBlock(t *testing.T) {
2929
assert.NoError(t, err)
3030
// bad envelope
3131
gb = testutil.ConstructTestBlock(t, 11, 1, 1)
32-
gb.Data = &common.BlockData{Data: [][]byte{[]byte{123}}}
32+
gb.Data = &common.BlockData{Data: [][]byte{{123}}}
3333
gb.Metadata.Metadata[common.BlockMetadataIndex_TRANSACTIONS_FILTER] =
3434
lutils.NewTxValidationFlags(len(gb.Data.Data))
3535
_, err = preprocessProtoBlock(nil, gb, false)
@@ -70,7 +70,7 @@ func TestPreprocessProtoBlock(t *testing.T) {
7070
var blockNum uint64 = 15
7171
txid := "testtxid1234"
7272
gb = testutil.ConstructBlockWithTxid(t, blockNum, []byte{123},
73-
[][]byte{[]byte{123}}, []string{txid}, false)
73+
[][]byte{{123}}, []string{txid}, false)
7474
flags = lutils.NewTxValidationFlags(len(gb.Data.Data))
7575
flags.SetFlag(0, peer.TxValidationCode_BAD_HEADER_EXTENSION)
7676
gb.Metadata.Metadata[common.BlockMetadataIndex_TRANSACTIONS_FILTER] = flags

core/peer/configtx_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ func (h *testHelper) sampleResourceConfig(version uint64, entries ...string) *co
193193
ChannelGroup: &common.ConfigGroup{
194194
Version: version,
195195
Groups: map[string]*common.ConfigGroup{
196-
resourcesconfig.ChaincodesGroupKey: &common.ConfigGroup{
196+
resourcesconfig.ChaincodesGroupKey: {
197197
Groups: ccGroups,
198198
ModPolicy: modPolicy,
199199
},
@@ -295,7 +295,7 @@ func (h *testHelper) computeDeltaResConfTx(t *testing.T, chainid string, source,
295295
sigHeader, err := localmsp.NewSigner().NewSignatureHeader()
296296
assert.NoError(t, err)
297297

298-
confUpdateEnv.Signatures = []*common.ConfigSignature{&common.ConfigSignature{
298+
confUpdateEnv.Signatures = []*common.ConfigSignature{{
299299
SignatureHeader: utils.MarshalOrPanic(sigHeader)}}
300300

301301
sigs, err := localmsp.NewSigner().Sign(util.ConcatenateBytes(confUpdateEnv.Signatures[0].SignatureHeader, confUpdateEnv.ConfigUpdate))

0 commit comments

Comments
 (0)