From ed275dcdaef3039d196f17cde0e18a7b218ad625 Mon Sep 17 00:00:00 2001 From: Solovyov1796 Date: Wed, 1 May 2024 12:26:39 +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 => 0gchaind}/main.go | 10 ++++++---- cmd/{kava/cmd => 0gchaind}/query.go | 2 +- cmd/{kava/cmd => 0gchaind}/root.go | 4 ++-- 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 18 files changed, 14 insertions(+), 12 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 => 0gchaind}/main.go (52%) rename cmd/{kava/cmd => 0gchaind}/query.go (98%) rename cmd/{kava/cmd => 0gchaind}/root.go (98%) 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 53a3aa9a..02e9f9bc 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 8962b14c..2fd84e35 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/main.go b/cmd/0gchaind/main.go similarity index 52% rename from cmd/kava/main.go rename to cmd/0gchaind/main.go index f15b33ec..5a1c4cfe 100644 --- a/cmd/kava/main.go +++ b/cmd/0gchaind/main.go @@ -6,14 +6,16 @@ import ( "github.com/cosmos/cosmos-sdk/server" svrcmd "github.com/cosmos/cosmos-sdk/server/cmd" - "github.com/0glabs/0g-chain/app" - "github.com/0glabs/0g-chain/cmd/kava/cmd" + "github.com/0glabs/0g-chain/chaincfg" ) func main() { - rootCmd := cmd.NewRootCmd() + chaincfg.SetSDKConfig().Seal() + chaincfg.RegisterDenoms() - if err := svrcmd.Execute(rootCmd, cmd.EnvPrefix, app.DefaultNodeHome); err != nil { + rootCmd := NewRootCmd() + + if err := svrcmd.Execute(rootCmd, chaincfg.EnvPrefix, chaincfg.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/root.go b/cmd/0gchaind/root.go similarity index 98% rename from cmd/kava/cmd/root.go rename to cmd/0gchaind/root.go index c8b6ce5c..3c957a90 100644 --- a/cmd/kava/cmd/root.go +++ b/cmd/0gchaind/root.go @@ -1,4 +1,4 @@ -package cmd +package main import ( "os" @@ -23,7 +23,7 @@ import ( "github.com/0glabs/0g-chain/app" "github.com/0glabs/0g-chain/app/params" kavaclient "github.com/0glabs/0g-chain/client" - "github.com/0glabs/0g-chain/cmd/kava/opendb" + "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/status.go b/cmd/0gchaind/status.go similarity index 99% rename from cmd/kava/cmd/status.go rename to cmd/0gchaind/status.go index ac6028f2..bab93f1c 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