From a28055bed2dff1bff270a5f5c1a5a7dd97311a77 Mon Sep 17 00:00:00 2001 From: Behrang Noruzi Niya Date: Sun, 14 May 2017 14:30:53 +0430 Subject: [PATCH] cmd: Fix minor bugs in init command (#446) --- cobra/cmd/init.go | 6 +++--- cobra/cmd/testdata/root.go.golden | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/cobra/cmd/init.go b/cobra/cmd/init.go index 788bdb56..0e2b22aa 100644 --- a/cobra/cmd/init.go +++ b/cobra/cmd/init.go @@ -197,13 +197,13 @@ func initConfig() { // Find home directory. home, err := homedir.Dir() if err != nil { - fmt.Println(home) + fmt.Println(err) os.Exit(1) } - // Search config in home directory with name ".cobra" (without extension). + // Search config in home directory with name ".{{ .appName }}" (without extension). viper.AddConfigPath(home) - viper.SetConfigName(".cobra") + viper.SetConfigName(".{{ .appName }}") } viper.AutomaticEnv() // read in environment variables that match diff --git a/cobra/cmd/testdata/root.go.golden b/cobra/cmd/testdata/root.go.golden index a8f4ff1a..13e9a776 100644 --- a/cobra/cmd/testdata/root.go.golden +++ b/cobra/cmd/testdata/root.go.golden @@ -70,13 +70,13 @@ func initConfig() { // Find home directory. home, err := homedir.Dir() if err != nil { - fmt.Println(home) + fmt.Println(err) os.Exit(1) } - // Search config in home directory with name ".cobra" (without extension). + // Search config in home directory with name ".testproject" (without extension). viper.AddConfigPath(home) - viper.SetConfigName(".cobra") + viper.SetConfigName(".testproject") } viper.AutomaticEnv() // read in environment variables that match