Skip to content

Instantly share code, notes, and snippets.

@miguelmota miguelmota/.env
Created Jun 12, 2019

Embed
What would you like to do?
Golang dotenv (.env) example
HOST=127.0.0.1
package main
import (
"fmt"
"log"
"os"
"github.com/joho/godotenv"
)
func main() {
err := godotenv.Load()
if err != nil {
log.Fatal("Error loading .env file")
}
fmt.Println(os.Getenv("HOST")) // 127.0.0.1
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.