diff --git a/pkg/configuration/configuration.go b/pkg/configuration/configuration.go index 0e8c401..128ca94 100644 --- a/pkg/configuration/configuration.go +++ b/pkg/configuration/configuration.go @@ -10,7 +10,6 @@ import ( "git.kle.li/tools/go-import-redirector/pkg/configuration/file" "git.kle.li/tools/go-import-redirector/pkg/packagelist" "github.com/fsnotify/fsnotify" - "github.com/spf13/cobra" "github.com/spf13/viper" ) @@ -33,9 +32,12 @@ func New(cfgFile string, hotReload bool, reloadFunction func()) *Configuration { } else { // Find home directory. home, err := os.UserHomeDir() - cobra.CheckErr(err) + if err == nil { + c.v.AddConfigPath(home) + } else { + fmt.Println("Unable to determine $HOME, not searching it for potential config") + } - c.v.AddConfigPath(home) c.v.AddConfigPath("/etc/") c.v.AddConfigPath(".") c.v.SetConfigType("yaml")