From c888c9728838ccc376cff9c7501f1631225b964f Mon Sep 17 00:00:00 2001 From: Elliot Morrison-Reed Date: Fri, 26 Aug 2016 21:49:38 +0200 Subject: [PATCH] Use os.Getenv("HOME") instead of "$HOME" for windows compatibility --- cobra/cmd/init.go | 2 +- cobra/cmd/root.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cobra/cmd/init.go b/cobra/cmd/init.go index 13792f12..5532a081 100644 --- a/cobra/cmd/init.go +++ b/cobra/cmd/init.go @@ -210,7 +210,7 @@ func initConfig() { } viper.SetConfigName(".{{ .appName }}") // name of config file (without extension) - viper.AddConfigPath("$HOME") // adding home directory as first search path + viper.AddConfigPath(os.Getenv("HOME")) // adding home directory as first search path viper.AutomaticEnv() // read in environment variables that match // If a config file is found, read it in. diff --git a/cobra/cmd/root.go b/cobra/cmd/root.go index 065c8bf4..d7b08c22 100644 --- a/cobra/cmd/root.go +++ b/cobra/cmd/root.go @@ -62,7 +62,7 @@ func initConfig() { } viper.SetConfigName(".cobra") // name of config file (without extension) - viper.AddConfigPath("$HOME") // adding home directory as first search path + viper.AddConfigPath(os.Getenv("HOME")) // adding home directory as first search path viper.AutomaticEnv() // read in environment variables that match // If a config file is found, read it in.