From c4039496d23e9db791a74b0dc6897f94e135251a Mon Sep 17 00:00:00 2001 From: dasbd72 Date: Mon, 19 Feb 2024 15:04:44 +0800 Subject: [PATCH] Ignore when .env not exist --- cmd/ccy-cli/balance.go | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/cmd/ccy-cli/balance.go b/cmd/ccy-cli/balance.go index 801ec4d..eba8240 100644 --- a/cmd/ccy-cli/balance.go +++ b/cmd/ccy-cli/balance.go @@ -9,20 +9,15 @@ import ( "github.com/dasbd72/asset-management/binance" "github.com/dasbd72/asset-management/max" "github.com/dasbd72/asset-management/okx" - "github.com/joho/godotenv" "github.com/spf13/cobra" ) func Balance(cmd *cobra.Command, args []string) error { // Load environment variables ctx := context.Background() - err := godotenv.Load() - if err != nil { - return err - } totalBalance := 0.0 - err = func() error { + err := func() error { apiKey := os.Getenv("BINANCE_API_KEY") apiSecret := os.Getenv("BINANCE_API_SECRET") if apiKey == "" || apiSecret == "" {