Skip to content

Commit 35a7dcb

Browse files
committed
all: gofmt -w -s
1 parent e0fde02 commit 35a7dcb

Some content is hidden

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

64 files changed

+343
-343
lines changed

accounts/abi/abi_test.go

+14-14
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,10 @@ func TestTypeCheck(t *testing.T) {
6767
{"uint16[3]", [4]uint16{1, 2, 3}, "abi: cannot use [4]uint16 as type [3]uint16 as argument"},
6868
{"uint16[3]", []uint16{1, 2, 3}, ""},
6969
{"uint16[3]", []uint16{1, 2, 3, 4}, "abi: cannot use [4]uint16 as type [3]uint16 as argument"},
70-
{"address[]", []common.Address{common.Address{1}}, ""},
71-
{"address[1]", []common.Address{common.Address{1}}, ""},
72-
{"address[1]", [1]common.Address{common.Address{1}}, ""},
73-
{"address[2]", [1]common.Address{common.Address{1}}, "abi: cannot use [1]array as type [2]array as argument"},
70+
{"address[]", []common.Address{{1}}, ""},
71+
{"address[1]", []common.Address{{1}}, ""},
72+
{"address[1]", [1]common.Address{{1}}, ""},
73+
{"address[2]", [1]common.Address{{1}}, "abi: cannot use [1]array as type [2]array as argument"},
7474
{"bytes32", [32]byte{}, ""},
7575
{"bytes32", [33]byte{}, "abi: cannot use [33]uint8 as type [32]uint8 as argument"},
7676
{"bytes32", common.Hash{1}, ""},
@@ -80,7 +80,7 @@ func TestTypeCheck(t *testing.T) {
8080
{"bytes", [2]byte{0, 1}, ""},
8181
{"bytes", common.Hash{1}, ""},
8282
{"string", "hello world", ""},
83-
{"bytes32[]", [][32]byte{[32]byte{}}, ""},
83+
{"bytes32[]", [][32]byte{{}}, ""},
8484
{"function", [24]byte{}, ""},
8585
} {
8686
typ, err := NewType(test.typ)
@@ -343,8 +343,8 @@ func TestPack(t *testing.T) {
343343
{"uint16[]", []uint16{1, 2}, formatSliceOutput([]byte{1}, []byte{2})},
344344
{"bytes20", [20]byte{1}, pad([]byte{1}, 32, false)},
345345
{"uint256[]", []*big.Int{big.NewInt(1), big.NewInt(2)}, formatSliceOutput([]byte{1}, []byte{2})},
346-
{"address[]", []common.Address{common.Address{1}, common.Address{2}}, formatSliceOutput(pad([]byte{1}, 20, false), pad([]byte{2}, 20, false))},
347-
{"bytes32[]", []common.Hash{common.Hash{1}, common.Hash{2}}, formatSliceOutput(pad([]byte{1}, 32, false), pad([]byte{2}, 32, false))},
346+
{"address[]", []common.Address{{1}, {2}}, formatSliceOutput(pad([]byte{1}, 20, false), pad([]byte{2}, 20, false))},
347+
{"bytes32[]", []common.Hash{{1}, {2}}, formatSliceOutput(pad([]byte{1}, 32, false), pad([]byte{2}, 32, false))},
348348
{"function", [24]byte{1}, pad([]byte{1}, 32, false)},
349349
} {
350350
typ, err := NewType(test.typ)
@@ -458,12 +458,12 @@ func TestReader(t *testing.T) {
458458
Uint256, _ := NewType("uint256")
459459
exp := ABI{
460460
Methods: map[string]Method{
461-
"balance": Method{
461+
"balance": {
462462
"balance", true, nil, nil,
463463
},
464-
"send": Method{
464+
"send": {
465465
"send", false, []Argument{
466-
Argument{"amount", Uint256, false},
466+
{"amount", Uint256, false},
467467
}, nil,
468468
},
469469
},
@@ -562,7 +562,7 @@ func TestTestSlice(t *testing.T) {
562562

563563
func TestMethodSignature(t *testing.T) {
564564
String, _ := NewType("string")
565-
m := Method{"foo", false, []Argument{Argument{"bar", String, false}, Argument{"baz", String, false}}, nil}
565+
m := Method{"foo", false, []Argument{{"bar", String, false}, {"baz", String, false}}, nil}
566566
exp := "foo(string,string)"
567567
if m.Sig() != exp {
568568
t.Error("signature mismatch", exp, "!=", m.Sig())
@@ -574,7 +574,7 @@ func TestMethodSignature(t *testing.T) {
574574
}
575575

576576
uintt, _ := NewType("uint")
577-
m = Method{"foo", false, []Argument{Argument{"bar", uintt, false}}, nil}
577+
m = Method{"foo", false, []Argument{{"bar", uintt, false}}, nil}
578578
exp = "foo(uint256)"
579579
if m.Sig() != exp {
580580
t.Error("signature mismatch", exp, "!=", m.Sig())
@@ -779,8 +779,8 @@ func TestBareEvents(t *testing.T) {
779779
"balance": {false, nil},
780780
"anon": {true, nil},
781781
"args": {false, []Argument{
782-
Argument{Name: "arg0", Type: arg0, Indexed: false},
783-
Argument{Name: "arg1", Type: arg1, Indexed: true},
782+
{Name: "arg0", Type: arg0, Indexed: false},
783+
{Name: "arg1", Type: arg1, Indexed: true},
784784
}},
785785
}
786786

build/ci.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ func doInstall(cmdline []string) {
195195
if err != nil {
196196
log.Fatal(err)
197197
}
198-
for name, _ := range pkgs {
198+
for name := range pkgs {
199199
if name == "main" {
200200
gobuild := goToolArch(*arch, "build", buildFlags(env)...)
201201
gobuild.Args = append(gobuild.Args, "-v")

cmd/swarm/main.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ func init() {
129129
app.HideVersion = true // we have a command to print the version
130130
app.Copyright = "Copyright 2013-2016 The go-ethereum Authors"
131131
app.Commands = []cli.Command{
132-
cli.Command{
132+
{
133133
Action: version,
134134
Name: "version",
135135
Usage: "Print version numbers",
@@ -138,7 +138,7 @@ func init() {
138138
The output of this command is supposed to be machine-readable.
139139
`,
140140
},
141-
cli.Command{
141+
{
142142
Action: upload,
143143
Name: "up",
144144
Usage: "upload a file or directory to swarm using the HTTP API",
@@ -147,7 +147,7 @@ The output of this command is supposed to be machine-readable.
147147
"upload a file or directory to swarm using the HTTP API and prints the root hash",
148148
`,
149149
},
150-
cli.Command{
150+
{
151151
Action: hash,
152152
Name: "hash",
153153
Usage: "print the swarm hash of a file or directory",

common/bytes.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ func Hex2BytesFixed(str string, flen int) []byte {
143143
return h
144144
} else {
145145
if len(h) > flen {
146-
return h[len(h)-flen : len(h)]
146+
return h[len(h)-flen:]
147147
} else {
148148
hh := make([]byte, flen)
149149
copy(hh[flen-len(h):flen], h[:])

common/math/dist_test.go

+18-18
Original file line numberDiff line numberDiff line change
@@ -41,24 +41,24 @@ func TestSum(t *testing.T) {
4141

4242
func TestDist(t *testing.T) {
4343
var vectors = []Vector{
44-
Vector{big.NewInt(1000), big.NewInt(1234)},
45-
Vector{big.NewInt(500), big.NewInt(10023)},
46-
Vector{big.NewInt(1034), big.NewInt(1987)},
47-
Vector{big.NewInt(1034), big.NewInt(1987)},
48-
Vector{big.NewInt(8983), big.NewInt(1977)},
49-
Vector{big.NewInt(98382), big.NewInt(1887)},
50-
Vector{big.NewInt(12398), big.NewInt(1287)},
51-
Vector{big.NewInt(12398), big.NewInt(1487)},
52-
Vector{big.NewInt(12398), big.NewInt(1987)},
53-
Vector{big.NewInt(12398), big.NewInt(128)},
54-
Vector{big.NewInt(12398), big.NewInt(1987)},
55-
Vector{big.NewInt(1398), big.NewInt(187)},
56-
Vector{big.NewInt(12328), big.NewInt(1927)},
57-
Vector{big.NewInt(12398), big.NewInt(1987)},
58-
Vector{big.NewInt(22398), big.NewInt(1287)},
59-
Vector{big.NewInt(1370), big.NewInt(1981)},
60-
Vector{big.NewInt(12398), big.NewInt(1957)},
61-
Vector{big.NewInt(42198), big.NewInt(1987)},
44+
{big.NewInt(1000), big.NewInt(1234)},
45+
{big.NewInt(500), big.NewInt(10023)},
46+
{big.NewInt(1034), big.NewInt(1987)},
47+
{big.NewInt(1034), big.NewInt(1987)},
48+
{big.NewInt(8983), big.NewInt(1977)},
49+
{big.NewInt(98382), big.NewInt(1887)},
50+
{big.NewInt(12398), big.NewInt(1287)},
51+
{big.NewInt(12398), big.NewInt(1487)},
52+
{big.NewInt(12398), big.NewInt(1987)},
53+
{big.NewInt(12398), big.NewInt(128)},
54+
{big.NewInt(12398), big.NewInt(1987)},
55+
{big.NewInt(1398), big.NewInt(187)},
56+
{big.NewInt(12328), big.NewInt(1927)},
57+
{big.NewInt(12398), big.NewInt(1987)},
58+
{big.NewInt(22398), big.NewInt(1287)},
59+
{big.NewInt(1370), big.NewInt(1981)},
60+
{big.NewInt(12398), big.NewInt(1957)},
61+
{big.NewInt(42198), big.NewInt(1987)},
6262
}
6363

6464
VectorsBy(GasSort).Sort(vectors)

core/blockchain.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ func NewBlockChain(chainDb ethdb.Database, config *params.ChainConfig, pow pow.P
150150
return nil, err
151151
}
152152
// Check the current state of the block hashes and make sure that we do not have any of the bad blocks in our chain
153-
for hash, _ := range BadHashes {
153+
for hash := range BadHashes {
154154
if header := bc.GetHeaderByHash(hash); header != nil {
155155
// get the canonical block corresponding to the offending header's number
156156
headerByNumber := bc.GetHeaderByNumber(header.Number.Uint64())

core/blockchain_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1107,7 +1107,7 @@ func TestCanonicalBlockRetrieval(t *testing.T) {
11071107

11081108
chain, _ := GenerateChain(params.TestChainConfig, genesis, db, 10, func(i int, gen *BlockGen) {})
11091109

1110-
for i, _ := range chain {
1110+
for i := range chain {
11111111
go func(block *types.Block) {
11121112
// try to retrieve a block by its canonical hash and see if the block data can be retrieved.
11131113
for {

core/state/iterator_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ func TestNodeIteratorCoverage(t *testing.T) {
4141
}
4242
}
4343
// Cross check the hashes and the database itself
44-
for hash, _ := range hashes {
44+
for hash := range hashes {
4545
if _, err := db.Get(hash.Bytes()); err != nil {
4646
t.Errorf("failed to retrieve reported node %x: %v", hash, err)
4747
}

core/state/managed_state_test.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ func TestRemove(t *testing.T) {
5252
ms, account := create()
5353

5454
nn := make([]bool, 10)
55-
for i, _ := range nn {
55+
for i := range nn {
5656
nn[i] = true
5757
}
5858
account.nonces = append(account.nonces, nn...)
@@ -68,7 +68,7 @@ func TestReuse(t *testing.T) {
6868
ms, account := create()
6969

7070
nn := make([]bool, 10)
71-
for i, _ := range nn {
71+
for i := range nn {
7272
nn[i] = true
7373
}
7474
account.nonces = append(account.nonces, nn...)
@@ -84,7 +84,7 @@ func TestReuse(t *testing.T) {
8484
func TestRemoteNonceChange(t *testing.T) {
8585
ms, account := create()
8686
nn := make([]bool, 10)
87-
for i, _ := range nn {
87+
for i := range nn {
8888
nn[i] = true
8989
}
9090
account.nonces = append(account.nonces, nn...)

core/state/statedb.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,7 @@ func (self *StateDB) Copy() *StateDB {
479479
logSize: self.logSize,
480480
}
481481
// Copy the dirty states and logs
482-
for addr, _ := range self.stateObjectsDirty {
482+
for addr := range self.stateObjectsDirty {
483483
state.stateObjects[addr] = self.stateObjects[addr].deepCopy(state, state.MarkStateObjectDirty)
484484
state.stateObjectsDirty[addr] = struct{}{}
485485
}
@@ -530,7 +530,7 @@ func (self *StateDB) GetRefund() *big.Int {
530530
// It is called in between transactions to get the root hash that
531531
// goes into transaction receipts.
532532
func (s *StateDB) IntermediateRoot(deleteEmptyObjects bool) common.Hash {
533-
for addr, _ := range s.stateObjectsDirty {
533+
for addr := range s.stateObjectsDirty {
534534
stateObject := s.stateObjects[addr]
535535
if stateObject.suicided || (deleteEmptyObjects && stateObject.empty()) {
536536
s.deleteStateObject(stateObject)
@@ -553,7 +553,7 @@ func (s *StateDB) DeleteSuicides() {
553553
// Reset refund so that any used-gas calculations can use this method.
554554
s.clearJournalAndRefund()
555555

556-
for addr, _ := range s.stateObjectsDirty {
556+
for addr := range s.stateObjectsDirty {
557557
stateObject := s.stateObjects[addr]
558558

559559
// If the object has been removed by a suicide

core/state/sync_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ func testIterativeRandomStateSync(t *testing.T, batch int) {
198198
for len(queue) > 0 {
199199
// Fetch all the queued nodes in a random order
200200
results := make([]trie.SyncResult, 0, len(queue))
201-
for hash, _ := range queue {
201+
for hash := range queue {
202202
data, err := srcDb.Get(hash.Bytes())
203203
if err != nil {
204204
t.Fatalf("failed to retrieve node data for %x: %v", hash, err)
@@ -235,7 +235,7 @@ func TestIterativeRandomDelayedStateSync(t *testing.T) {
235235
for len(queue) > 0 {
236236
// Sync only half of the scheduled nodes, even those in random order
237237
results := make([]trie.SyncResult, 0, len(queue)/2+1)
238-
for hash, _ := range queue {
238+
for hash := range queue {
239239
delete(queue, hash)
240240

241241
data, err := srcDb.Get(hash.Bytes())

core/tx_list.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ func (m *txSortedMap) Filter(filter func(*types.Transaction) bool) types.Transac
110110
// If transactions were removed, the heap and cache are ruined
111111
if len(removed) > 0 {
112112
*m.index = make([]uint64, 0, len(m.items))
113-
for nonce, _ := range m.items {
113+
for nonce := range m.items {
114114
*m.index = append(*m.index, nonce)
115115
}
116116
heap.Init(m.index)

core/tx_pool.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -609,7 +609,7 @@ func (pool *TxPool) promoteExecutables(state *state.StateDB) {
609609
if queued > maxQueuedInTotal {
610610
// Sort all accounts with queued transactions by heartbeat
611611
addresses := make(addresssByHeartbeat, 0, len(pool.queue))
612-
for addr, _ := range pool.queue {
612+
for addr := range pool.queue {
613613
addresses = append(addresses, addressByHeartbeat{addr, pool.beats[addr]})
614614
}
615615
sort.Sort(addresses)

0 commit comments

Comments
 (0)