Reading .env file in golang
$ go get github.com/pleycpl/godotenv # First download repo in go directory
Key=Value
Mongo=20830
Token=asd123asdasd234
package main
import (
"fmt"
"github.com/pleycpl/godotenv"
)
func main() {
env := godotenv.Godotenv(".env") // You should write your .env file's path.
fmt.Println(env) // env variable is map.
fmt.Println(env["Key"])
fmt.Println(env["Mongo"])
fmt.Println(env["Token"])
}