mirror of
https://github.com/outbackdingo/ghorg.git
synced 2026-01-27 10:19:03 +00:00
use homedir lib
This commit is contained in:
11
main.go
11
main.go
@@ -3,10 +3,10 @@ package main
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
|
||||
"github.com/gabrie30/ghorg/cmd"
|
||||
"github.com/joho/godotenv"
|
||||
homedir "github.com/mitchellh/go-homedir"
|
||||
)
|
||||
|
||||
func main() {
|
||||
@@ -15,8 +15,13 @@ func main() {
|
||||
}
|
||||
|
||||
func init() {
|
||||
home := os.Getenv("HOME")
|
||||
err := godotenv.Load(home + "/.ghorg")
|
||||
home, err := homedir.Dir()
|
||||
|
||||
if err != nil {
|
||||
log.Fatal("Error trying to find users home directory")
|
||||
}
|
||||
|
||||
err = godotenv.Load(home + "/.ghorg")
|
||||
if err != nil {
|
||||
log.Fatal("Error loading .ghorg file, create a .env from the sample and run Make install")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user