From d2fb2f6e82b1303732cb1e4a64add6bba552b2e7 Mon Sep 17 00:00:00 2001 From: Solovyov1796 Date: Sat, 3 Aug 2024 19:36:47 +0800 Subject: [PATCH] revise file structure in cmd --- cmd/{kava/cmd => 0gchaind}/app.go | 2 +- cmd/{kava/cmd => 0gchaind}/assert-invariants.go | 2 +- cmd/{kava/cmd => 0gchaind}/genaccounts.go | 2 +- cmd/{kava/cmd => 0gchaind}/keys.go | 2 +- cmd/{kava => 0gchaind}/main.go | 5 ++--- cmd/{kava/cmd => 0gchaind}/query.go | 2 +- cmd/{kava/cmd => 0gchaind}/rocksdb/compact.go | 0 cmd/{kava/cmd => 0gchaind}/rocksdb/rocksdb.go | 0 cmd/{kava/cmd => 0gchaind}/rocksdb/rocksdb_dummy.go | 0 cmd/{kava/cmd => 0gchaind}/root.go | 6 +++--- cmd/{kava/cmd => 0gchaind}/shard.go | 2 +- cmd/{kava/cmd => 0gchaind}/status.go | 2 +- cmd/{kava/cmd => 0gchaind}/tx.go | 2 +- cmd/{kava => }/opendb/metrics.go | 0 cmd/{kava => }/opendb/opendb.go | 0 cmd/{kava => }/opendb/opendb_rocksdb.go | 0 cmd/{kava => }/opendb/opendb_rocksdb_test.go | 0 cmd/{kava => }/opendb/props_loader.go | 0 cmd/{kava => }/opendb/props_loader_test.go | 0 cmd/{kava => }/opendb/stat_parser.go | 0 cmd/{kava => }/opendb/stat_parser_test.go | 0 cmd/{kava => }/opendb/stats_loader.go | 0 cmd/{kava => }/opendb/stats_loader_test.go | 0 23 files changed, 13 insertions(+), 14 deletions(-) rename cmd/{kava/cmd => 0gchaind}/app.go (99%) rename cmd/{kava/cmd => 0gchaind}/assert-invariants.go (99%) rename cmd/{kava/cmd => 0gchaind}/genaccounts.go (99%) rename cmd/{kava/cmd => 0gchaind}/keys.go (99%) rename cmd/{kava => 0gchaind}/main.go (63%) rename cmd/{kava/cmd => 0gchaind}/query.go (98%) rename cmd/{kava/cmd => 0gchaind}/rocksdb/compact.go (100%) rename cmd/{kava/cmd => 0gchaind}/rocksdb/rocksdb.go (100%) rename cmd/{kava/cmd => 0gchaind}/rocksdb/rocksdb_dummy.go (100%) rename cmd/{kava/cmd => 0gchaind}/root.go (97%) rename cmd/{kava/cmd => 0gchaind}/shard.go (99%) rename cmd/{kava/cmd => 0gchaind}/status.go (99%) rename cmd/{kava/cmd => 0gchaind}/tx.go (98%) rename cmd/{kava => }/opendb/metrics.go (100%) rename cmd/{kava => }/opendb/opendb.go (100%) rename cmd/{kava => }/opendb/opendb_rocksdb.go (100%) rename cmd/{kava => }/opendb/opendb_rocksdb_test.go (100%) rename cmd/{kava => }/opendb/props_loader.go (100%) rename cmd/{kava => }/opendb/props_loader_test.go (100%) rename cmd/{kava => }/opendb/stat_parser.go (100%) rename cmd/{kava => }/opendb/stat_parser_test.go (100%) rename cmd/{kava => }/opendb/stats_loader.go (100%) rename cmd/{kava => }/opendb/stats_loader_test.go (100%) diff --git a/cmd/kava/cmd/app.go b/cmd/0gchaind/app.go similarity index 99% rename from cmd/kava/cmd/app.go rename to cmd/0gchaind/app.go index 1ed481bc..7d1806e2 100644 --- a/cmd/kava/cmd/app.go +++ b/cmd/0gchaind/app.go @@ -1,4 +1,4 @@ -package cmd +package main import ( "errors" diff --git a/cmd/kava/cmd/assert-invariants.go b/cmd/0gchaind/assert-invariants.go similarity index 99% rename from cmd/kava/cmd/assert-invariants.go rename to cmd/0gchaind/assert-invariants.go index fbdeb825..6a83442e 100644 --- a/cmd/kava/cmd/assert-invariants.go +++ b/cmd/0gchaind/assert-invariants.go @@ -1,4 +1,4 @@ -package cmd +package main import ( "encoding/json" diff --git a/cmd/kava/cmd/genaccounts.go b/cmd/0gchaind/genaccounts.go similarity index 99% rename from cmd/kava/cmd/genaccounts.go rename to cmd/0gchaind/genaccounts.go index 5a5d157f..ef5e920e 100644 --- a/cmd/kava/cmd/genaccounts.go +++ b/cmd/0gchaind/genaccounts.go @@ -1,5 +1,5 @@ // Sourced from https://github.com/evmos/ethermint/blob/main/cmd/ethermintd/genaccounts.go -package cmd +package main import ( "bufio" diff --git a/cmd/kava/cmd/keys.go b/cmd/0gchaind/keys.go similarity index 99% rename from cmd/kava/cmd/keys.go rename to cmd/0gchaind/keys.go index 9d8587c0..3ec6ee0a 100644 --- a/cmd/kava/cmd/keys.go +++ b/cmd/0gchaind/keys.go @@ -1,4 +1,4 @@ -package cmd +package main import ( "bufio" diff --git a/cmd/kava/main.go b/cmd/0gchaind/main.go similarity index 63% rename from cmd/kava/main.go rename to cmd/0gchaind/main.go index f15b33ec..f1168753 100644 --- a/cmd/kava/main.go +++ b/cmd/0gchaind/main.go @@ -7,13 +7,12 @@ import ( svrcmd "github.com/cosmos/cosmos-sdk/server/cmd" "github.com/0glabs/0g-chain/app" - "github.com/0glabs/0g-chain/cmd/kava/cmd" ) func main() { - rootCmd := cmd.NewRootCmd() + rootCmd := NewRootCmd() - if err := svrcmd.Execute(rootCmd, cmd.EnvPrefix, app.DefaultNodeHome); err != nil { + if err := svrcmd.Execute(rootCmd, EnvPrefix, app.DefaultNodeHome); err != nil { switch e := err.(type) { case server.ErrorCode: os.Exit(e.Code) diff --git a/cmd/kava/cmd/query.go b/cmd/0gchaind/query.go similarity index 98% rename from cmd/kava/cmd/query.go rename to cmd/0gchaind/query.go index a83e751d..e8021e99 100644 --- a/cmd/kava/cmd/query.go +++ b/cmd/0gchaind/query.go @@ -1,4 +1,4 @@ -package cmd +package main import ( "github.com/cosmos/cosmos-sdk/client" diff --git a/cmd/kava/cmd/rocksdb/compact.go b/cmd/0gchaind/rocksdb/compact.go similarity index 100% rename from cmd/kava/cmd/rocksdb/compact.go rename to cmd/0gchaind/rocksdb/compact.go diff --git a/cmd/kava/cmd/rocksdb/rocksdb.go b/cmd/0gchaind/rocksdb/rocksdb.go similarity index 100% rename from cmd/kava/cmd/rocksdb/rocksdb.go rename to cmd/0gchaind/rocksdb/rocksdb.go diff --git a/cmd/kava/cmd/rocksdb/rocksdb_dummy.go b/cmd/0gchaind/rocksdb/rocksdb_dummy.go similarity index 100% rename from cmd/kava/cmd/rocksdb/rocksdb_dummy.go rename to cmd/0gchaind/rocksdb/rocksdb_dummy.go diff --git a/cmd/kava/cmd/root.go b/cmd/0gchaind/root.go similarity index 97% rename from cmd/kava/cmd/root.go rename to cmd/0gchaind/root.go index ef453633..73ea1f54 100644 --- a/cmd/kava/cmd/root.go +++ b/cmd/0gchaind/root.go @@ -1,4 +1,4 @@ -package cmd +package main import ( "fmt" @@ -25,8 +25,8 @@ import ( "github.com/0glabs/0g-chain/app" "github.com/0glabs/0g-chain/app/params" - "github.com/0glabs/0g-chain/cmd/kava/cmd/rocksdb" - "github.com/0glabs/0g-chain/cmd/kava/opendb" + "github.com/0glabs/0g-chain/cmd/0gchaind/rocksdb" + "github.com/0glabs/0g-chain/cmd/opendb" ) // EnvPrefix is the prefix environment variables must have to configure the app. diff --git a/cmd/kava/cmd/shard.go b/cmd/0gchaind/shard.go similarity index 99% rename from cmd/kava/cmd/shard.go rename to cmd/0gchaind/shard.go index 7aba4499..7840f353 100644 --- a/cmd/kava/cmd/shard.go +++ b/cmd/0gchaind/shard.go @@ -1,4 +1,4 @@ -package cmd +package main import ( "fmt" diff --git a/cmd/kava/cmd/status.go b/cmd/0gchaind/status.go similarity index 99% rename from cmd/kava/cmd/status.go rename to cmd/0gchaind/status.go index bc5165a0..8c15dc0f 100644 --- a/cmd/kava/cmd/status.go +++ b/cmd/0gchaind/status.go @@ -1,4 +1,4 @@ -package cmd +package main import ( "context" diff --git a/cmd/kava/cmd/tx.go b/cmd/0gchaind/tx.go similarity index 98% rename from cmd/kava/cmd/tx.go rename to cmd/0gchaind/tx.go index 2d6b4875..167e4b01 100644 --- a/cmd/kava/cmd/tx.go +++ b/cmd/0gchaind/tx.go @@ -1,4 +1,4 @@ -package cmd +package main import ( "github.com/cosmos/cosmos-sdk/client" diff --git a/cmd/kava/opendb/metrics.go b/cmd/opendb/metrics.go similarity index 100% rename from cmd/kava/opendb/metrics.go rename to cmd/opendb/metrics.go diff --git a/cmd/kava/opendb/opendb.go b/cmd/opendb/opendb.go similarity index 100% rename from cmd/kava/opendb/opendb.go rename to cmd/opendb/opendb.go diff --git a/cmd/kava/opendb/opendb_rocksdb.go b/cmd/opendb/opendb_rocksdb.go similarity index 100% rename from cmd/kava/opendb/opendb_rocksdb.go rename to cmd/opendb/opendb_rocksdb.go diff --git a/cmd/kava/opendb/opendb_rocksdb_test.go b/cmd/opendb/opendb_rocksdb_test.go similarity index 100% rename from cmd/kava/opendb/opendb_rocksdb_test.go rename to cmd/opendb/opendb_rocksdb_test.go diff --git a/cmd/kava/opendb/props_loader.go b/cmd/opendb/props_loader.go similarity index 100% rename from cmd/kava/opendb/props_loader.go rename to cmd/opendb/props_loader.go diff --git a/cmd/kava/opendb/props_loader_test.go b/cmd/opendb/props_loader_test.go similarity index 100% rename from cmd/kava/opendb/props_loader_test.go rename to cmd/opendb/props_loader_test.go diff --git a/cmd/kava/opendb/stat_parser.go b/cmd/opendb/stat_parser.go similarity index 100% rename from cmd/kava/opendb/stat_parser.go rename to cmd/opendb/stat_parser.go diff --git a/cmd/kava/opendb/stat_parser_test.go b/cmd/opendb/stat_parser_test.go similarity index 100% rename from cmd/kava/opendb/stat_parser_test.go rename to cmd/opendb/stat_parser_test.go diff --git a/cmd/kava/opendb/stats_loader.go b/cmd/opendb/stats_loader.go similarity index 100% rename from cmd/kava/opendb/stats_loader.go rename to cmd/opendb/stats_loader.go diff --git a/cmd/kava/opendb/stats_loader_test.go b/cmd/opendb/stats_loader_test.go similarity index 100% rename from cmd/kava/opendb/stats_loader_test.go rename to cmd/opendb/stats_loader_test.go