diff --git a/cmd/cli/main.go b/cmd/cli/main.go new file mode 100644 index 0000000000000000000000000000000000000000..af4b7d8075c704e119d2b13d1541773d9d062385 --- /dev/null +++ b/cmd/cli/main.go @@ -0,0 +1,11 @@ +package main + +import ( + "os" + + "github.com/ethereum/go-ethereum/internal/cli" +) + +func main() { + os.Exit(cli.Run(os.Args[1:])) +} diff --git a/command/account.go b/internal/cli/account.go similarity index 98% rename from command/account.go rename to internal/cli/account.go index 747b6b8dbaea8131965e6e35dad5d8b8ceb248d1..b8661821d0a7dd13d66f54c6833ae136299d2080 100644 --- a/command/account.go +++ b/internal/cli/account.go @@ -1,4 +1,4 @@ -package main +package cli import "github.com/mitchellh/cli" diff --git a/command/account_import.go b/internal/cli/account_import.go similarity index 95% rename from command/account_import.go rename to internal/cli/account_import.go index 331a45aac6f852020ece7576eb1a660962144fdf..8c9ff40e5868beeb33b6a75c864a5ebb497c57eb 100644 --- a/command/account_import.go +++ b/internal/cli/account_import.go @@ -1,11 +1,11 @@ -package main +package cli import ( "fmt" "github.com/ethereum/go-ethereum/cmd/utils" - "github.com/ethereum/go-ethereum/command/flagset" "github.com/ethereum/go-ethereum/crypto" + "github.com/ethereum/go-ethereum/internal/cli/flagset" ) type AccountImportCommand struct { diff --git a/command/account_list.go b/internal/cli/account_list.go similarity index 94% rename from command/account_list.go rename to internal/cli/account_list.go index d41e0c0d654669e5717de421ba3d91332736ed40..360d41b558ad2665ca23c9a215ac7333b556fcf0 100644 --- a/command/account_list.go +++ b/internal/cli/account_list.go @@ -1,10 +1,10 @@ -package main +package cli import ( "fmt" "github.com/ethereum/go-ethereum/accounts" - "github.com/ethereum/go-ethereum/command/flagset" + "github.com/ethereum/go-ethereum/internal/cli/flagset" ) type AccountListCommand struct { diff --git a/command/account_new.go b/internal/cli/account_new.go similarity index 94% rename from command/account_new.go rename to internal/cli/account_new.go index 59118a9a3764e70cf2305d2ffb752a9f663b0b60..3334384cb05477be408e1465aeaa4893826957cb 100644 --- a/command/account_new.go +++ b/internal/cli/account_new.go @@ -1,9 +1,9 @@ -package main +package cli import ( "fmt" - "github.com/ethereum/go-ethereum/command/flagset" + "github.com/ethereum/go-ethereum/internal/cli/flagset" ) type AccountNewCommand struct { diff --git a/command/chain.go b/internal/cli/chain.go similarity index 98% rename from command/chain.go rename to internal/cli/chain.go index ed8ca9a5f868b8e74dc20821948c4167e9dbfa4d..b43f22f999a7ff43ba7913cf1feb96e9070e8488 100644 --- a/command/chain.go +++ b/internal/cli/chain.go @@ -1,4 +1,4 @@ -package main +package cli import ( "github.com/mitchellh/cli" diff --git a/command/chain_sethead.go b/internal/cli/chain_sethead.go similarity index 92% rename from command/chain_sethead.go rename to internal/cli/chain_sethead.go index 0dfed6268bedd3c4a3fba7c050c45aaa869e731d..127ac38f15dd608f6c98e0982996476c403bc3e8 100644 --- a/command/chain_sethead.go +++ b/internal/cli/chain_sethead.go @@ -1,12 +1,12 @@ -package main +package cli import ( "context" "fmt" "strconv" - "github.com/ethereum/go-ethereum/command/flagset" - "github.com/ethereum/go-ethereum/command/server/proto" + "github.com/ethereum/go-ethereum/internal/cli/flagset" + "github.com/ethereum/go-ethereum/internal/cli/server/proto" ) // ChainSetHeadCommand is the command to group the peers commands diff --git a/command/chain_watch.go b/internal/cli/chain_watch.go similarity index 100% rename from command/chain_watch.go rename to internal/cli/chain_watch.go diff --git a/command/main.go b/internal/cli/command.go similarity index 95% rename from command/main.go rename to internal/cli/command.go index 31b8bf92d7164fb0f8491003e9871d990e9e985f..d164791f801e9fcf5215b7aa41dea9756c08f63d 100644 --- a/command/main.go +++ b/internal/cli/command.go @@ -1,23 +1,19 @@ -package main +package cli import ( "fmt" "os" "github.com/ethereum/go-ethereum/accounts/keystore" - "github.com/ethereum/go-ethereum/command/flagset" - "github.com/ethereum/go-ethereum/command/server" - "github.com/ethereum/go-ethereum/command/server/proto" + "github.com/ethereum/go-ethereum/internal/cli/flagset" + "github.com/ethereum/go-ethereum/internal/cli/server" + "github.com/ethereum/go-ethereum/internal/cli/server/proto" "github.com/ethereum/go-ethereum/node" "github.com/mitchellh/cli" "github.com/ryanuber/columnize" "google.golang.org/grpc" ) -func main() { - os.Exit(Run(os.Args[1:])) -} - func Run(args []string) int { commands := commands() diff --git a/command/debug.go b/internal/cli/debug.go similarity index 97% rename from command/debug.go rename to internal/cli/debug.go index f3f2484b0baff382fc8d949196649fb32c0f3cd9..a6b6ff79731d86d91b2051e9afdfcc8d21cbeb98 100644 --- a/command/debug.go +++ b/internal/cli/debug.go @@ -1,4 +1,4 @@ -package main +package cli // Based on https://github.com/hashicorp/nomad/blob/main/command/operator_debug.go @@ -16,8 +16,8 @@ import ( "syscall" "time" - "github.com/ethereum/go-ethereum/command/flagset" - "github.com/ethereum/go-ethereum/command/server/proto" + "github.com/ethereum/go-ethereum/internal/cli/flagset" + "github.com/ethereum/go-ethereum/internal/cli/server/proto" "github.com/golang/protobuf/jsonpb" gproto "github.com/golang/protobuf/proto" "github.com/golang/protobuf/ptypes/empty" diff --git a/command/flagset/flagset.go b/internal/cli/flagset/flagset.go similarity index 100% rename from command/flagset/flagset.go rename to internal/cli/flagset/flagset.go diff --git a/command/flagset/flagset_test.go b/internal/cli/flagset/flagset_test.go similarity index 100% rename from command/flagset/flagset_test.go rename to internal/cli/flagset/flagset_test.go diff --git a/command/peers.go b/internal/cli/peers.go similarity index 98% rename from command/peers.go rename to internal/cli/peers.go index 4b99288aee63d5272cb68c8660817ef224fc5f2f..b5913662222244fb771e6119a0a819abaa506bd0 100644 --- a/command/peers.go +++ b/internal/cli/peers.go @@ -1,4 +1,4 @@ -package main +package cli import ( "github.com/mitchellh/cli" diff --git a/command/peers_add.go b/internal/cli/peers_add.go similarity index 90% rename from command/peers_add.go rename to internal/cli/peers_add.go index 796b8966819b8f3067b188760825a1a060f8ac65..2b2fe127e03a7c6fb8b83614ec6100d00064510b 100644 --- a/command/peers_add.go +++ b/internal/cli/peers_add.go @@ -1,10 +1,10 @@ -package main +package cli import ( "context" - "github.com/ethereum/go-ethereum/command/flagset" - "github.com/ethereum/go-ethereum/command/server/proto" + "github.com/ethereum/go-ethereum/internal/cli/flagset" + "github.com/ethereum/go-ethereum/internal/cli/server/proto" ) // PeersAddCommand is the command to group the peers commands diff --git a/command/peers_list.go b/internal/cli/peers_list.go similarity index 91% rename from command/peers_list.go rename to internal/cli/peers_list.go index af0bc410fa1311711c492924c8cd489918d9d8e2..a42e0011a533ea68c05a02e5bc7b78dfc5e7bb33 100644 --- a/command/peers_list.go +++ b/internal/cli/peers_list.go @@ -1,12 +1,12 @@ -package main +package cli import ( "context" "fmt" "strings" - "github.com/ethereum/go-ethereum/command/flagset" - "github.com/ethereum/go-ethereum/command/server/proto" + "github.com/ethereum/go-ethereum/internal/cli/flagset" + "github.com/ethereum/go-ethereum/internal/cli/server/proto" ) // PeersListCommand is the command to group the peers commands diff --git a/command/peers_remove.go b/internal/cli/peers_remove.go similarity index 91% rename from command/peers_remove.go rename to internal/cli/peers_remove.go index 432a35fdcb0869987d3a7386fa463554ce7bffc4..979f13925119f4b98dd5964d07417329e3f11d3f 100644 --- a/command/peers_remove.go +++ b/internal/cli/peers_remove.go @@ -1,10 +1,10 @@ -package main +package cli import ( "context" - "github.com/ethereum/go-ethereum/command/flagset" - "github.com/ethereum/go-ethereum/command/server/proto" + "github.com/ethereum/go-ethereum/internal/cli/flagset" + "github.com/ethereum/go-ethereum/internal/cli/server/proto" ) // PeersRemoveCommand is the command to group the peers commands diff --git a/command/peers_status.go b/internal/cli/peers_status.go similarity index 92% rename from command/peers_status.go rename to internal/cli/peers_status.go index adb7b2e850ecda1537a65a6f5d1ef7be87ca4721..c1da2b2647e041d8da86d29de4d747d3f0681fe3 100644 --- a/command/peers_status.go +++ b/internal/cli/peers_status.go @@ -1,12 +1,12 @@ -package main +package cli import ( "context" "fmt" "strings" - "github.com/ethereum/go-ethereum/command/flagset" - "github.com/ethereum/go-ethereum/command/server/proto" + "github.com/ethereum/go-ethereum/internal/cli/flagset" + "github.com/ethereum/go-ethereum/internal/cli/server/proto" ) // PeersStatusCommand is the command to group the peers commands diff --git a/command/server/chains/allocs/mainnet.json b/internal/cli/server/chains/allocs/mainnet.json similarity index 100% rename from command/server/chains/allocs/mainnet.json rename to internal/cli/server/chains/allocs/mainnet.json diff --git a/command/server/chains/allocs/mumbai.json b/internal/cli/server/chains/allocs/mumbai.json similarity index 100% rename from command/server/chains/allocs/mumbai.json rename to internal/cli/server/chains/allocs/mumbai.json diff --git a/command/server/chains/chain.go b/internal/cli/server/chains/chain.go similarity index 100% rename from command/server/chains/chain.go rename to internal/cli/server/chains/chain.go diff --git a/command/server/chains/mainnet.go b/internal/cli/server/chains/mainnet.go similarity index 100% rename from command/server/chains/mainnet.go rename to internal/cli/server/chains/mainnet.go diff --git a/command/server/chains/mumbai.go b/internal/cli/server/chains/mumbai.go similarity index 100% rename from command/server/chains/mumbai.go rename to internal/cli/server/chains/mumbai.go diff --git a/command/server/chains/utils.go b/internal/cli/server/chains/utils.go similarity index 100% rename from command/server/chains/utils.go rename to internal/cli/server/chains/utils.go diff --git a/command/server/command.go b/internal/cli/server/command.go similarity index 100% rename from command/server/command.go rename to internal/cli/server/command.go diff --git a/command/server/config.go b/internal/cli/server/config.go similarity index 99% rename from command/server/config.go rename to internal/cli/server/config.go index c9ffff481d1bd66ae2167cb7acd407967b393938..457ee53aa9973c24443f4611d7db2b26603e28f7 100644 --- a/command/server/config.go +++ b/internal/cli/server/config.go @@ -14,12 +14,12 @@ import ( godebug "runtime/debug" - "github.com/ethereum/go-ethereum/command/server/chains" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/fdlimit" "github.com/ethereum/go-ethereum/eth/downloader" "github.com/ethereum/go-ethereum/eth/ethconfig" "github.com/ethereum/go-ethereum/eth/gasprice" + "github.com/ethereum/go-ethereum/internal/cli/server/chains" "github.com/ethereum/go-ethereum/log" "github.com/ethereum/go-ethereum/node" "github.com/ethereum/go-ethereum/p2p" diff --git a/command/server/config_legacy.go b/internal/cli/server/config_legacy.go similarity index 100% rename from command/server/config_legacy.go rename to internal/cli/server/config_legacy.go diff --git a/command/server/config_legacy_test.go b/internal/cli/server/config_legacy_test.go similarity index 100% rename from command/server/config_legacy_test.go rename to internal/cli/server/config_legacy_test.go diff --git a/command/server/config_test.go b/internal/cli/server/config_test.go similarity index 100% rename from command/server/config_test.go rename to internal/cli/server/config_test.go diff --git a/command/server/flags.go b/internal/cli/server/flags.go similarity index 99% rename from command/server/flags.go rename to internal/cli/server/flags.go index 76828ef6fcb0c6e761259722e4c6f7f39a75f007..09e5a7bf780f42156c745b7fe6c1419fd6204df6 100644 --- a/command/server/flags.go +++ b/internal/cli/server/flags.go @@ -1,7 +1,7 @@ package server import ( - "github.com/ethereum/go-ethereum/command/flagset" + "github.com/ethereum/go-ethereum/internal/cli/flagset" ) func (c *Command) Flags() *flagset.Flagset { diff --git a/command/server/pprof/pprof.go b/internal/cli/server/pprof/pprof.go similarity index 100% rename from command/server/pprof/pprof.go rename to internal/cli/server/pprof/pprof.go diff --git a/command/server/proto/server.pb.go b/internal/cli/server/proto/server.pb.go similarity index 100% rename from command/server/proto/server.pb.go rename to internal/cli/server/proto/server.pb.go diff --git a/command/server/proto/server.proto b/internal/cli/server/proto/server.proto similarity index 100% rename from command/server/proto/server.proto rename to internal/cli/server/proto/server.proto diff --git a/command/server/proto/server_grpc.pb.go b/internal/cli/server/proto/server_grpc.pb.go similarity index 100% rename from command/server/proto/server_grpc.pb.go rename to internal/cli/server/proto/server_grpc.pb.go diff --git a/command/server/server.go b/internal/cli/server/server.go similarity index 99% rename from command/server/server.go rename to internal/cli/server/server.go index afc0550b2a0aafdb69adc49397906fcd3ca28b94..67c335dff4dfd247f19e0b252407221021c00ca8 100644 --- a/command/server/server.go +++ b/internal/cli/server/server.go @@ -11,11 +11,11 @@ import ( "time" "github.com/ethereum/go-ethereum/accounts/keystore" - "github.com/ethereum/go-ethereum/command/server/proto" "github.com/ethereum/go-ethereum/eth" "github.com/ethereum/go-ethereum/eth/tracers" "github.com/ethereum/go-ethereum/ethstats" "github.com/ethereum/go-ethereum/graphql" + "github.com/ethereum/go-ethereum/internal/cli/server/proto" "github.com/ethereum/go-ethereum/log" "github.com/ethereum/go-ethereum/metrics" "github.com/ethereum/go-ethereum/metrics/influxdb" diff --git a/command/server/service.go b/internal/cli/server/service.go similarity index 98% rename from command/server/service.go rename to internal/cli/server/service.go index 83692693ee43af283b322ca6477db96c30090f29..e8e39285810c65fd990bed3f92e110afc31c88ff 100644 --- a/command/server/service.go +++ b/internal/cli/server/service.go @@ -7,10 +7,10 @@ import ( "reflect" "strings" - "github.com/ethereum/go-ethereum/command/server/pprof" - "github.com/ethereum/go-ethereum/command/server/proto" "github.com/ethereum/go-ethereum/core" "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/internal/cli/server/pprof" + "github.com/ethereum/go-ethereum/internal/cli/server/proto" "github.com/ethereum/go-ethereum/p2p" "github.com/ethereum/go-ethereum/p2p/enode" gproto "github.com/golang/protobuf/proto" diff --git a/command/server/service_test.go b/internal/cli/server/service_test.go similarity index 89% rename from command/server/service_test.go rename to internal/cli/server/service_test.go index 715401b12badecfde18c126b89b8cc84bfce1b87..7850525686b6708fb0ec928bde70b315a5e83cb4 100644 --- a/command/server/service_test.go +++ b/internal/cli/server/service_test.go @@ -4,7 +4,7 @@ import ( "math/big" "testing" - "github.com/ethereum/go-ethereum/command/server/proto" + "github.com/ethereum/go-ethereum/internal/cli/server/proto" "github.com/stretchr/testify/assert" ) diff --git a/command/server/testdata/simple.hcl b/internal/cli/server/testdata/simple.hcl similarity index 100% rename from command/server/testdata/simple.hcl rename to internal/cli/server/testdata/simple.hcl diff --git a/command/server/testdata/simple.json b/internal/cli/server/testdata/simple.json similarity index 100% rename from command/server/testdata/simple.json rename to internal/cli/server/testdata/simple.json diff --git a/command/status.go b/internal/cli/status.go similarity index 96% rename from command/status.go rename to internal/cli/status.go index ddfdb50daa7036fb1be1ac25aadcb59fa3c24791..ef0a42172b53e264ee77d4d979493141dd84507a 100644 --- a/command/status.go +++ b/internal/cli/status.go @@ -1,11 +1,11 @@ -package main +package cli import ( "context" "fmt" "strings" - "github.com/ethereum/go-ethereum/command/server/proto" + "github.com/ethereum/go-ethereum/internal/cli/server/proto" "github.com/golang/protobuf/ptypes/empty" ) diff --git a/command/version.go b/internal/cli/version.go similarity index 97% rename from command/version.go rename to internal/cli/version.go index 5483ea5402a9ed9d1b648e02c2630fbe3264126c..7433f208b29ef6c6502974d7704b963c087721e9 100644 --- a/command/version.go +++ b/internal/cli/version.go @@ -1,4 +1,4 @@ -package main +package cli import ( "github.com/ethereum/go-ethereum/params"