From 52e26c52616cdd8151e9e79006d2e02e33d08e4f Mon Sep 17 00:00:00 2001 From: tyiuhc Date: Thu, 25 Jul 2024 12:04:40 -0700 Subject: [PATCH] remove godotenv.Load error check for unit tests --- pkg/experiment/local/client_eu_test.go | 8 ++------ pkg/experiment/local/client_test.go | 8 ++------ 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/pkg/experiment/local/client_eu_test.go b/pkg/experiment/local/client_eu_test.go index b4a01ff..66b7568 100644 --- a/pkg/experiment/local/client_eu_test.go +++ b/pkg/experiment/local/client_eu_test.go @@ -3,7 +3,6 @@ package local import ( "github.com/amplitude/experiment-go-server/pkg/experiment" "github.com/joho/godotenv" - "log" "os" "testing" ) @@ -11,10 +10,7 @@ import ( var clientEU *Client func init() { - err := godotenv.Load() - if err != nil { - log.Fatalf("Error loading .env file: %v", err) - } + godotenv.Load() projectApiKey := os.Getenv("EU_API_KEY") secretKey := os.Getenv("EU_SECRET_KEY") cohortSyncConfig := CohortSyncConfig{ @@ -23,7 +19,7 @@ func init() { } clientEU = Initialize("server-Qlp7XiSu6JtP2S3JzA95PnP27duZgQCF", &Config{CohortSyncConfig: &cohortSyncConfig, ServerZone: "eu"}) - err = clientEU.Start() + err := clientEU.Start() if err != nil { panic(err) } diff --git a/pkg/experiment/local/client_test.go b/pkg/experiment/local/client_test.go index 2cb346b..65e4da6 100644 --- a/pkg/experiment/local/client_test.go +++ b/pkg/experiment/local/client_test.go @@ -3,7 +3,6 @@ package local import ( "github.com/amplitude/experiment-go-server/pkg/experiment" "github.com/joho/godotenv" - "log" "os" "testing" ) @@ -11,10 +10,7 @@ import ( var client *Client func init() { - err := godotenv.Load() - if err != nil { - log.Fatalf("Error loading .env file: %v", err) - } + godotenv.Load() projectApiKey := os.Getenv("API_KEY") secretKey := os.Getenv("SECRET_KEY") cohortSyncConfig := CohortSyncConfig{ @@ -23,7 +19,7 @@ func init() { } client = Initialize("server-qz35UwzJ5akieoAdIgzM4m9MIiOLXLoz", &Config{CohortSyncConfig: &cohortSyncConfig}) - err = client.Start() + err := client.Start() if err != nil { panic(err) }