Skip to content

Commit

Permalink
remove godotenv.Load error check for unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tyiuhc committed Jul 25, 2024
1 parent 2c69e4f commit 52e26c5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 12 deletions.
8 changes: 2 additions & 6 deletions pkg/experiment/local/client_eu_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,14 @@ package local
import (
"github.com/amplitude/experiment-go-server/pkg/experiment"
"github.com/joho/godotenv"
"log"
"os"
"testing"
)

var clientEU *Client

func init() {
err := godotenv.Load()
if err != nil {
log.Fatalf("Error loading .env file: %v", err)
}
godotenv.Load()

Check failure on line 13 in pkg/experiment/local/client_eu_test.go

View workflow job for this annotation

GitHub Actions / Lint

Error return value of `godotenv.Load` is not checked (errcheck)
projectApiKey := os.Getenv("EU_API_KEY")
secretKey := os.Getenv("EU_SECRET_KEY")
cohortSyncConfig := CohortSyncConfig{
Expand All @@ -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)
}
Expand Down
8 changes: 2 additions & 6 deletions pkg/experiment/local/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,14 @@ package local
import (
"github.com/amplitude/experiment-go-server/pkg/experiment"
"github.com/joho/godotenv"
"log"
"os"
"testing"
)

var client *Client

func init() {
err := godotenv.Load()
if err != nil {
log.Fatalf("Error loading .env file: %v", err)
}
godotenv.Load()

Check failure on line 13 in pkg/experiment/local/client_test.go

View workflow job for this annotation

GitHub Actions / Lint

Error return value of `godotenv.Load` is not checked (errcheck)
projectApiKey := os.Getenv("API_KEY")
secretKey := os.Getenv("SECRET_KEY")
cohortSyncConfig := CohortSyncConfig{
Expand All @@ -23,7 +19,7 @@ func init() {
}
client = Initialize("server-qz35UwzJ5akieoAdIgzM4m9MIiOLXLoz",
&Config{CohortSyncConfig: &cohortSyncConfig})
err = client.Start()
err := client.Start()
if err != nil {
panic(err)
}
Expand Down

0 comments on commit 52e26c5

Please sign in to comment.