very first commit
This commit is contained in:
28
cmd/main.go
Normal file
28
cmd/main.go
Normal file
@@ -0,0 +1,28 @@
|
||||
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")
|
||||
}
|
||||
Reference in New Issue
Block a user