Skip to content

Commit 46882f7

Browse files
elizabethengelmani-norden
authored andcommitted
Apply gosimple changes to statediff
1 parent c38b566 commit 46882f7

File tree

2 files changed

+4
-15
lines changed

2 files changed

+4
-15
lines changed

statediff/builder/helpers.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ func findIntersection(a, b []string) []string {
5454
if iOfA >= lenA {
5555
return updates
5656
}
57-
break
5857
// a[iOfA] == b[iOfB]
5958
case 0:
6059
updates = append(updates, a[iOfA])
@@ -63,14 +62,12 @@ func findIntersection(a, b []string) []string {
6362
if iOfA >= lenA || iOfB >= lenB {
6463
return updates
6564
}
66-
break
6765
// a[iOfA] > b[iOfB]
6866
case 1:
6967
iOfB++
7068
if iOfB >= lenB {
7169
return updates
7270
}
73-
break
7471
}
7572
}
7673

statediff/publisher/csv.go

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,7 @@ func (p *publisher) publishStateDiffToCSV(sd builder.StateDiff) (string, error)
4747

4848
var data [][]string
4949
data = append(data, Headers)
50-
for _, row := range accumulateAccountRows(sd) {
51-
data = append(data, row)
52-
}
50+
data = append(data, accumulateAccountRows(sd)...)
5351
for _, value := range data {
5452
err := writer.Write(value)
5553
if err != nil {
@@ -65,25 +63,19 @@ func accumulateAccountRows(sd builder.StateDiff) [][]string {
6563
for accountAddr, accountDiff := range sd.CreatedAccounts {
6664
formattedAccountData := formatAccountData(accountAddr, accountDiff, sd, createdAccountAction)
6765

68-
for _, accountData := range formattedAccountData {
69-
accountRows = append(accountRows, accountData)
70-
}
66+
accountRows = append(accountRows, formattedAccountData...)
7167
}
7268

7369
for accountAddr, accountDiff := range sd.UpdatedAccounts {
7470
formattedAccountData := formatAccountData(accountAddr, accountDiff, sd, updatedAccountAction)
7571

76-
for _, accountData := range formattedAccountData {
77-
accountRows = append(accountRows, accountData)
78-
}
72+
accountRows = append(accountRows, formattedAccountData...)
7973
}
8074

8175
for accountAddr, accountDiff := range sd.DeletedAccounts {
8276
formattedAccountData := formatAccountData(accountAddr, accountDiff, sd, deletedAccountAction)
8377

84-
for _, accountData := range formattedAccountData {
85-
accountRows = append(accountRows, accountData)
86-
}
78+
accountRows = append(accountRows, formattedAccountData...)
8779
}
8880

8981
return accountRows

0 commit comments

Comments
 (0)