diff --git a/README.md b/README.md index a1b13ddd..3c290f4a 100644 --- a/README.md +++ b/README.md @@ -246,6 +246,7 @@ func initConfig() { // Search config in home directory with name ".cobra" (without extension). viper.AddConfigPath(home) + viper.SetConfigType("yaml") viper.SetConfigName(".cobra") } diff --git a/cobra/cmd/root.go b/cobra/cmd/root.go index f27ae7e6..86254c64 100644 --- a/cobra/cmd/root.go +++ b/cobra/cmd/root.go @@ -67,6 +67,7 @@ func initConfig() { // Search config in home directory with name ".cobra" (without extension). viper.AddConfigPath(home) + viper.SetConfigType("yaml") viper.SetConfigName(".cobra") } diff --git a/cobra/cmd/testdata/root.go.golden b/cobra/cmd/testdata/root.go.golden index be040365..26dedff7 100644 --- a/cobra/cmd/testdata/root.go.golden +++ b/cobra/cmd/testdata/root.go.golden @@ -73,6 +73,7 @@ func initConfig() { // Search config in home directory with name ".testproject" (without extension). viper.AddConfigPath(home) + viper.SetConfigType("yaml") viper.SetConfigName(".testproject") } diff --git a/cobra/tpl/main.go b/cobra/tpl/main.go index 0b9c6610..fbb3372b 100644 --- a/cobra/tpl/main.go +++ b/cobra/tpl/main.go @@ -86,6 +86,7 @@ func initConfig() { // Search config in home directory with name ".{{ .AppName }}" (without extension). viper.AddConfigPath(home) + viper.SetConfigType("yaml") viper.SetConfigName(".{{ .AppName }}") }