-
-
Notifications
You must be signed in to change notification settings - Fork 275
Not reading my .env file #181
Copy link
Copy link
Closed
Description
I have my .env file with 2 properties
BOT_TOKEN=rightHereIsWhereMyTokenIs
TEST=1234
when I go run main.go with this code this is my output
env: environment variable "BOT_TOKEN" should not be empty
{BotToken: Test:0}
What am I doing wrong?
package main
import (
"fmt"
"github.com/caarlos0/env/v6"
)
type config struct {
BotToken string `env:"BOT_TOKEN,notEmpty"`
Test int32 `env:"TEST"`
}
func main() {
cfg := config{}
if err := env.Parse(&cfg); err != nil {
fmt.Printf("%+v\n", err)
}
fmt.Printf("%+v\n", cfg)
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels