diff --git a/cmd/snapshots/manifest/manifest.go b/cmd/snapshots/manifest/manifest.go index 7ce76cc561a..fe36be79c27 100644 --- a/cmd/snapshots/manifest/manifest.go +++ b/cmd/snapshots/manifest/manifest.go @@ -12,12 +12,13 @@ import ( "strings" "time" + "github.com/urfave/cli/v2" + "github.com/ledgerwatch/erigon-lib/downloader" "github.com/ledgerwatch/erigon-lib/downloader/snaptype" "github.com/ledgerwatch/erigon/cmd/snapshots/sync" "github.com/ledgerwatch/erigon/cmd/utils" "github.com/ledgerwatch/erigon/turbo/logging" - "github.com/urfave/cli/v2" ) var ( @@ -286,7 +287,7 @@ func verifyManifest(ctx context.Context, srcSession *downloader.RCloneSession, v var extra string if len(manifestFiles) != 0 { - files := make([]string, len(manifestFiles)) + files := make([]string, 0, len(manifestFiles)) for file := range manifestFiles { files = append(files, file) @@ -296,7 +297,7 @@ func verifyManifest(ctx context.Context, srcSession *downloader.RCloneSession, v } if len(dirFiles) != 0 { - files := make([]string, len(dirFiles)) + files := make([]string, 0, len(dirFiles)) for file := range dirFiles { files = append(files, file) diff --git a/core/blockchain.go b/core/blockchain.go index d44b230d5a0..2c8ef71d71b 100644 --- a/core/blockchain.go +++ b/core/blockchain.go @@ -233,7 +233,7 @@ func logReceipts(receipts types.Receipts, txns types.Transactions, cc *chain.Con return } - marshalled := make([]map[string]interface{}, len(receipts)) + marshalled := make([]map[string]interface{}, 0, len(receipts)) for i, receipt := range receipts { txn := txns[i] marshalled = append(marshalled, ethutils.MarshalReceipt(receipt, txn, cc, header, txn.Hash(), true)) diff --git a/diagnostics/logs.go b/diagnostics/logs.go index 420fa2c926a..f3d44e5c178 100644 --- a/diagnostics/logs.go +++ b/diagnostics/logs.go @@ -70,7 +70,7 @@ func writeLogsList(w http.ResponseWriter, dirPath string) { Size int64 `json:"size"` } - files := make([]file, len(infos)) + files := make([]file, 0, len(infos)) for _, fileInfo := range infos { files = append(files, file{Name: fileInfo.Name(), Size: fileInfo.Size()})