Skip to content

Commit 19bb011

Browse files
karalabeGrapeBaBa
authored andcommittedNov 2, 2024
internal/flags: remove Merge, it's identical to slices.Concat (ethereum#30706)
This is a noop change to not have custom code for stdlib functionality.
1 parent e40c5e9 commit 19bb011

13 files changed

+54
-58
lines changed
 

‎cmd/blsync/main.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import (
2020
"context"
2121
"fmt"
2222
"os"
23+
"slices"
2324

2425
"github.com/ethereum/go-ethereum/beacon/blsync"
2526
"github.com/ethereum/go-ethereum/cmd/utils"
@@ -33,7 +34,7 @@ import (
3334

3435
func main() {
3536
app := flags.NewApp("beacon light syncer tool")
36-
app.Flags = flags.Merge([]cli.Flag{
37+
app.Flags = slices.Concat([]cli.Flag{
3738
utils.BeaconApiFlag,
3839
utils.BeaconApiHeaderFlag,
3940
utils.BeaconThresholdFlag,

‎cmd/devp2p/discv4cmd.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@ import (
2121
"fmt"
2222
"net"
2323
"net/http"
24+
"slices"
2425
"strconv"
2526
"strings"
2627
"time"
2728

2829
"github.com/ethereum/go-ethereum/cmd/devp2p/internal/v4test"
2930
"github.com/ethereum/go-ethereum/common"
3031
"github.com/ethereum/go-ethereum/crypto"
31-
"github.com/ethereum/go-ethereum/internal/flags"
3232
"github.com/ethereum/go-ethereum/log"
3333
"github.com/ethereum/go-ethereum/p2p/discover"
3434
"github.com/ethereum/go-ethereum/p2p/enode"
@@ -83,15 +83,15 @@ var (
8383
Name: "listen",
8484
Usage: "Runs a discovery node",
8585
Action: discv4Listen,
86-
Flags: flags.Merge(discoveryNodeFlags, []cli.Flag{
86+
Flags: slices.Concat(discoveryNodeFlags, []cli.Flag{
8787
httpAddrFlag,
8888
}),
8989
}
9090
discv4CrawlCommand = &cli.Command{
9191
Name: "crawl",
9292
Usage: "Updates a nodes.json file with random nodes found in the DHT",
9393
Action: discv4Crawl,
94-
Flags: flags.Merge(discoveryNodeFlags, []cli.Flag{crawlTimeoutFlag, crawlParallelismFlag}),
94+
Flags: slices.Concat(discoveryNodeFlags, []cli.Flag{crawlTimeoutFlag, crawlParallelismFlag}),
9595
}
9696
discv4TestCommand = &cli.Command{
9797
Name: "test",

‎cmd/devp2p/discv5cmd.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ package main
1919
import (
2020
"errors"
2121
"fmt"
22+
"slices"
2223
"time"
2324

2425
"github.com/ethereum/go-ethereum/cmd/devp2p/internal/v5test"
2526
"github.com/ethereum/go-ethereum/common"
26-
"github.com/ethereum/go-ethereum/internal/flags"
2727
"github.com/ethereum/go-ethereum/p2p/discover"
2828
"github.com/urfave/cli/v2"
2929
)
@@ -56,7 +56,7 @@ var (
5656
Name: "crawl",
5757
Usage: "Updates a nodes.json file with random nodes found in the DHT",
5858
Action: discv5Crawl,
59-
Flags: flags.Merge(discoveryNodeFlags, []cli.Flag{
59+
Flags: slices.Concat(discoveryNodeFlags, []cli.Flag{
6060
crawlTimeoutFlag,
6161
}),
6262
}

‎cmd/evm/main.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import (
2121
"fmt"
2222
"math/big"
2323
"os"
24+
"slices"
2425

2526
"github.com/ethereum/go-ethereum/cmd/evm/internal/t8ntool"
2627
"github.com/ethereum/go-ethereum/internal/debug"
@@ -254,7 +255,7 @@ var traceFlags = []cli.Flag{
254255
var app = flags.NewApp("the evm command line interface")
255256

256257
func init() {
257-
app.Flags = flags.Merge(vmFlags, traceFlags, debug.Flags)
258+
app.Flags = slices.Concat(vmFlags, traceFlags, debug.Flags)
258259
app.Commands = []*cli.Command{
259260
compileCommand,
260261
disasmCommand,

‎cmd/evm/runner.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import (
2424
"math/big"
2525
"os"
2626
goruntime "runtime"
27+
"slices"
2728
"testing"
2829
"time"
2930

@@ -50,7 +51,7 @@ var runCommand = &cli.Command{
5051
Usage: "Run arbitrary evm binary",
5152
ArgsUsage: "<code>",
5253
Description: `The run command runs arbitrary EVM code.`,
53-
Flags: flags.Merge(vmFlags, traceFlags),
54+
Flags: slices.Concat(vmFlags, traceFlags),
5455
}
5556

5657
// readGenesis will read the given JSON format genesis file and return

‎cmd/geth/chaincmd.go

+8-8
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import (
2222
"fmt"
2323
"os"
2424
"runtime"
25+
"slices"
2526
"strconv"
2627
"sync/atomic"
2728
"time"
@@ -36,7 +37,6 @@ import (
3637
"github.com/ethereum/go-ethereum/crypto"
3738
"github.com/ethereum/go-ethereum/ethdb"
3839
"github.com/ethereum/go-ethereum/internal/era"
39-
"github.com/ethereum/go-ethereum/internal/flags"
4040
"github.com/ethereum/go-ethereum/log"
4141
"github.com/ethereum/go-ethereum/metrics"
4242
"github.com/ethereum/go-ethereum/params"
@@ -49,7 +49,7 @@ var (
4949
Name: "init",
5050
Usage: "Bootstrap and initialize a new genesis block",
5151
ArgsUsage: "<genesisPath>",
52-
Flags: flags.Merge([]cli.Flag{
52+
Flags: slices.Concat([]cli.Flag{
5353
utils.CachePreimagesFlag,
5454
utils.OverrideCancun,
5555
utils.OverrideVerkle,
@@ -76,7 +76,7 @@ if one is set. Otherwise it prints the genesis from the datadir.`,
7676
Name: "import",
7777
Usage: "Import a blockchain file",
7878
ArgsUsage: "<filename> (<filename 2> ... <filename N>) ",
79-
Flags: flags.Merge([]cli.Flag{
79+
Flags: slices.Concat([]cli.Flag{
8080
utils.CacheFlag,
8181
utils.SyncModeFlag,
8282
utils.GCModeFlag,
@@ -115,7 +115,7 @@ processing will proceed even if an individual RLP-file import failure occurs.`,
115115
Name: "export",
116116
Usage: "Export blockchain into file",
117117
ArgsUsage: "<filename> [<blockNumFirst> <blockNumLast>]",
118-
Flags: flags.Merge([]cli.Flag{
118+
Flags: slices.Concat([]cli.Flag{
119119
utils.CacheFlag,
120120
utils.SyncModeFlag,
121121
}, utils.DatabaseFlags),
@@ -131,7 +131,7 @@ be gzipped.`,
131131
Name: "import-history",
132132
Usage: "Import an Era archive",
133133
ArgsUsage: "<dir>",
134-
Flags: flags.Merge([]cli.Flag{
134+
Flags: slices.Concat([]cli.Flag{
135135
utils.TxLookupLimitFlag,
136136
},
137137
utils.DatabaseFlags,
@@ -147,7 +147,7 @@ from Era archives.
147147
Name: "export-history",
148148
Usage: "Export blockchain history to Era archives",
149149
ArgsUsage: "<dir> <first> <last>",
150-
Flags: flags.Merge(utils.DatabaseFlags),
150+
Flags: slices.Concat(utils.DatabaseFlags),
151151
Description: `
152152
The export-history command will export blocks and their corresponding receipts
153153
into Era archives. Eras are typically packaged in steps of 8192 blocks.
@@ -158,7 +158,7 @@ into Era archives. Eras are typically packaged in steps of 8192 blocks.
158158
Name: "import-preimages",
159159
Usage: "Import the preimage database from an RLP stream",
160160
ArgsUsage: "<datafile>",
161-
Flags: flags.Merge([]cli.Flag{
161+
Flags: slices.Concat([]cli.Flag{
162162
utils.CacheFlag,
163163
utils.SyncModeFlag,
164164
}, utils.DatabaseFlags),
@@ -173,7 +173,7 @@ It's deprecated, please use "geth db import" instead.
173173
Name: "dump",
174174
Usage: "Dump a specific block from storage",
175175
ArgsUsage: "[? <blockHash> | <blockNum>]",
176-
Flags: flags.Merge([]cli.Flag{
176+
Flags: slices.Concat([]cli.Flag{
177177
utils.CacheFlag,
178178
utils.IterativeOutputFlag,
179179
utils.ExcludeCodeFlag,

‎cmd/geth/config.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import (
2323
"os"
2424
"reflect"
2525
"runtime"
26+
"slices"
2627
"strings"
2728
"unicode"
2829

@@ -53,7 +54,7 @@ var (
5354
Name: "dumpconfig",
5455
Usage: "Export configuration values in a TOML format",
5556
ArgsUsage: "<dumpfile (optional)>",
56-
Flags: flags.Merge(nodeFlags, rpcFlags),
57+
Flags: slices.Concat(nodeFlags, rpcFlags),
5758
Description: `Export configuration values in TOML format (to stdout by default).`,
5859
}
5960

‎cmd/geth/consolecmd.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ package main
1818

1919
import (
2020
"fmt"
21+
"slices"
2122
"strings"
2223

2324
"github.com/ethereum/go-ethereum/cmd/utils"
2425
"github.com/ethereum/go-ethereum/console"
25-
"github.com/ethereum/go-ethereum/internal/flags"
2626
"github.com/urfave/cli/v2"
2727
)
2828

@@ -33,7 +33,7 @@ var (
3333
Action: localConsole,
3434
Name: "console",
3535
Usage: "Start an interactive JavaScript environment",
36-
Flags: flags.Merge(nodeFlags, rpcFlags, consoleFlags),
36+
Flags: slices.Concat(nodeFlags, rpcFlags, consoleFlags),
3737
Description: `
3838
The Geth console is an interactive shell for the JavaScript runtime environment
3939
which exposes a node admin interface as well as the Ðapp JavaScript API.
@@ -45,7 +45,7 @@ See https://geth.ethereum.org/docs/interacting-with-geth/javascript-console.`,
4545
Name: "attach",
4646
Usage: "Start an interactive JavaScript environment (connect to node)",
4747
ArgsUsage: "[endpoint]",
48-
Flags: flags.Merge([]cli.Flag{utils.DataDirFlag, utils.HttpHeaderFlag}, consoleFlags),
48+
Flags: slices.Concat([]cli.Flag{utils.DataDirFlag, utils.HttpHeaderFlag}, consoleFlags),
4949
Description: `
5050
The Geth console is an interactive shell for the JavaScript runtime environment
5151
which exposes a node admin interface as well as the Ðapp JavaScript API.
@@ -58,7 +58,7 @@ This command allows to open a console on a running geth node.`,
5858
Name: "js",
5959
Usage: "(DEPRECATED) Execute the specified JavaScript files",
6060
ArgsUsage: "<jsfile> [jsfile...]",
61-
Flags: flags.Merge(nodeFlags, consoleFlags),
61+
Flags: slices.Concat(nodeFlags, consoleFlags),
6262
Description: `
6363
The JavaScript VM exposes a node admin interface as well as the Ðapp
6464
JavaScript API. See https://geth.ethereum.org/docs/interacting-with-geth/javascript-console`,

‎cmd/geth/dbcmd.go

+15-15
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import (
2222
"os"
2323
"os/signal"
2424
"path/filepath"
25+
"slices"
2526
"strconv"
2627
"strings"
2728
"syscall"
@@ -36,7 +37,6 @@ import (
3637
"github.com/ethereum/go-ethereum/core/types"
3738
"github.com/ethereum/go-ethereum/crypto"
3839
"github.com/ethereum/go-ethereum/ethdb"
39-
"github.com/ethereum/go-ethereum/internal/flags"
4040
"github.com/ethereum/go-ethereum/log"
4141
"github.com/ethereum/go-ethereum/rlp"
4242
"github.com/ethereum/go-ethereum/trie"
@@ -60,7 +60,7 @@ var (
6060
Name: "removedb",
6161
Usage: "Remove blockchain and state databases",
6262
ArgsUsage: "",
63-
Flags: flags.Merge(utils.DatabaseFlags,
63+
Flags: slices.Concat(utils.DatabaseFlags,
6464
[]cli.Flag{removeStateDataFlag, removeChainDataFlag}),
6565
Description: `
6666
Remove blockchain and state databases`,
@@ -89,7 +89,7 @@ Remove blockchain and state databases`,
8989
Action: inspect,
9090
Name: "inspect",
9191
ArgsUsage: "<prefix> <start>",
92-
Flags: flags.Merge([]cli.Flag{
92+
Flags: slices.Concat([]cli.Flag{
9393
utils.SyncModeFlag,
9494
}, utils.NetworkFlags, utils.DatabaseFlags),
9595
Usage: "Inspect the storage size for each type of data in the database",
@@ -99,7 +99,7 @@ Remove blockchain and state databases`,
9999
Action: checkStateContent,
100100
Name: "check-state-content",
101101
ArgsUsage: "<start (optional)>",
102-
Flags: flags.Merge(utils.NetworkFlags, utils.DatabaseFlags),
102+
Flags: slices.Concat(utils.NetworkFlags, utils.DatabaseFlags),
103103
Usage: "Verify that state data is cryptographically correct",
104104
Description: `This command iterates the entire database for 32-byte keys, looking for rlp-encoded trie nodes.
105105
For each trie node encountered, it checks that the key corresponds to the keccak256(value). If this is not true, this indicates
@@ -109,15 +109,15 @@ a data corruption.`,
109109
Action: dbStats,
110110
Name: "stats",
111111
Usage: "Print leveldb statistics",
112-
Flags: flags.Merge([]cli.Flag{
112+
Flags: slices.Concat([]cli.Flag{
113113
utils.SyncModeFlag,
114114
}, utils.NetworkFlags, utils.DatabaseFlags),
115115
}
116116
dbCompactCmd = &cli.Command{
117117
Action: dbCompact,
118118
Name: "compact",
119119
Usage: "Compact leveldb database. WARNING: May take a very long time",
120-
Flags: flags.Merge([]cli.Flag{
120+
Flags: slices.Concat([]cli.Flag{
121121
utils.SyncModeFlag,
122122
utils.CacheFlag,
123123
utils.CacheDatabaseFlag,
@@ -131,7 +131,7 @@ corruption if it is aborted during execution'!`,
131131
Name: "get",
132132
Usage: "Show the value of a database key",
133133
ArgsUsage: "<hex-encoded key>",
134-
Flags: flags.Merge([]cli.Flag{
134+
Flags: slices.Concat([]cli.Flag{
135135
utils.SyncModeFlag,
136136
}, utils.NetworkFlags, utils.DatabaseFlags),
137137
Description: "This command looks up the specified database key from the database.",
@@ -141,7 +141,7 @@ corruption if it is aborted during execution'!`,
141141
Name: "delete",
142142
Usage: "Delete a database key (WARNING: may corrupt your database)",
143143
ArgsUsage: "<hex-encoded key>",
144-
Flags: flags.Merge([]cli.Flag{
144+
Flags: slices.Concat([]cli.Flag{
145145
utils.SyncModeFlag,
146146
}, utils.NetworkFlags, utils.DatabaseFlags),
147147
Description: `This command deletes the specified database key from the database.
@@ -152,7 +152,7 @@ WARNING: This is a low-level operation which may cause database corruption!`,
152152
Name: "put",
153153
Usage: "Set the value of a database key (WARNING: may corrupt your database)",
154154
ArgsUsage: "<hex-encoded key> <hex-encoded value>",
155-
Flags: flags.Merge([]cli.Flag{
155+
Flags: slices.Concat([]cli.Flag{
156156
utils.SyncModeFlag,
157157
}, utils.NetworkFlags, utils.DatabaseFlags),
158158
Description: `This command sets a given database key to the given value.
@@ -163,7 +163,7 @@ WARNING: This is a low-level operation which may cause database corruption!`,
163163
Name: "dumptrie",
164164
Usage: "Show the storage key/values of a given storage trie",
165165
ArgsUsage: "<hex-encoded state root> <hex-encoded account hash> <hex-encoded storage trie root> <hex-encoded start (optional)> <int max elements (optional)>",
166-
Flags: flags.Merge([]cli.Flag{
166+
Flags: slices.Concat([]cli.Flag{
167167
utils.SyncModeFlag,
168168
}, utils.NetworkFlags, utils.DatabaseFlags),
169169
Description: "This command looks up the specified database key from the database.",
@@ -173,7 +173,7 @@ WARNING: This is a low-level operation which may cause database corruption!`,
173173
Name: "freezer-index",
174174
Usage: "Dump out the index of a specific freezer table",
175175
ArgsUsage: "<freezer-type> <table-type> <start (int)> <end (int)>",
176-
Flags: flags.Merge([]cli.Flag{
176+
Flags: slices.Concat([]cli.Flag{
177177
utils.SyncModeFlag,
178178
}, utils.NetworkFlags, utils.DatabaseFlags),
179179
Description: "This command displays information about the freezer index.",
@@ -183,7 +183,7 @@ WARNING: This is a low-level operation which may cause database corruption!`,
183183
Name: "import",
184184
Usage: "Imports leveldb-data from an exported RLP dump.",
185185
ArgsUsage: "<dumpfile> <start (optional)",
186-
Flags: flags.Merge([]cli.Flag{
186+
Flags: slices.Concat([]cli.Flag{
187187
utils.SyncModeFlag,
188188
}, utils.NetworkFlags, utils.DatabaseFlags),
189189
Description: "The import command imports the specific chain data from an RLP encoded stream.",
@@ -193,7 +193,7 @@ WARNING: This is a low-level operation which may cause database corruption!`,
193193
Name: "export",
194194
Usage: "Exports the chain data into an RLP dump. If the <dumpfile> has .gz suffix, gzip compression will be used.",
195195
ArgsUsage: "<type> <dumpfile>",
196-
Flags: flags.Merge([]cli.Flag{
196+
Flags: slices.Concat([]cli.Flag{
197197
utils.SyncModeFlag,
198198
}, utils.NetworkFlags, utils.DatabaseFlags),
199199
Description: "Exports the specified chain data to an RLP encoded stream, optionally gzip-compressed.",
@@ -202,7 +202,7 @@ WARNING: This is a low-level operation which may cause database corruption!`,
202202
Action: showMetaData,
203203
Name: "metadata",
204204
Usage: "Shows metadata about the chain status.",
205-
Flags: flags.Merge([]cli.Flag{
205+
Flags: slices.Concat([]cli.Flag{
206206
utils.SyncModeFlag,
207207
}, utils.NetworkFlags, utils.DatabaseFlags),
208208
Description: "Shows metadata about the chain status.",
@@ -212,7 +212,7 @@ WARNING: This is a low-level operation which may cause database corruption!`,
212212
Name: "inspect-history",
213213
Usage: "Inspect the state history within block range",
214214
ArgsUsage: "<address> [OPTIONAL <storage-slot>]",
215-
Flags: flags.Merge([]cli.Flag{
215+
Flags: slices.Concat([]cli.Flag{
216216
utils.SyncModeFlag,
217217
&cli.Uint64Flag{
218218
Name: "start",

0 commit comments

Comments
 (0)