29 lines
412 B
Go
29 lines
412 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"log"
|
|
"os"
|
|
|
|
"github.com/joho/godotenv"
|
|
)
|
|
|
|
// init is invoked before main()
|
|
func init() {
|
|
// loads values from .env into the system
|
|
if err := godotenv.Load(); err != nil {
|
|
log.Print("No .env file found")
|
|
}
|
|
}
|
|
|
|
func main() {
|
|
// Get the GREETING environment variable
|
|
greeting, exists := os.LookupEnv("GREETING")
|
|
|
|
if exists {
|
|
fmt.Println(greeting)
|
|
}
|
|
|
|
fmt.Println("fin")
|
|
}
|