Skip to content

Commit 09163b8

Browse files
committed
drop mitchellh/go-homedir (spf13#853)
1 parent 298c1c4 commit 09163b8

File tree

4 files changed

+5
-9
lines changed

4 files changed

+5
-9
lines changed

README.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,6 @@ import (
194194
"fmt"
195195
"os"
196196

197-
homedir "github.com/mitchellh/go-homedir"
198197
"github.com/spf13/cobra"
199198
"github.com/spf13/viper"
200199
)
@@ -240,14 +239,13 @@ func initConfig() {
240239
viper.SetConfigFile(cfgFile)
241240
} else {
242241
// Find home directory.
243-
home, err := homedir.Dir()
242+
home, err := os.UserHomeDir()
244243
cobra.CheckErr(err)
245244

246245
// Search config in home directory with name ".cobra" (without extension).
247246
viper.AddConfigPath(home)
248247
viper.SetConfigName(".cobra")
249248
}
250-
251249
viper.AutomaticEnv()
252250

253251
if err := viper.ReadInConfig(); err == nil {

cobra/cmd/root.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ package cmd
1515

1616
import (
1717
"fmt"
18+
"os"
1819

19-
homedir "github.com/mitchellh/go-homedir"
2020
"github.com/spf13/cobra"
2121
"github.com/spf13/viper"
2222
)
@@ -62,7 +62,7 @@ func initConfig() {
6262
viper.SetConfigFile(cfgFile)
6363
} else {
6464
// Find home directory.
65-
home, err := homedir.Dir()
65+
home, err := os.UserHomeDir()
6666
cobra.CheckErr(err)
6767

6868
// Search config in home directory with name ".cobra" (without extension).

cobra/cmd/testdata/root.go.golden

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import (
2020
"os"
2121
"github.com/spf13/cobra"
2222

23-
homedir "github.com/mitchellh/go-homedir"
2423
"github.com/spf13/viper"
2524
)
2625

@@ -68,7 +67,7 @@ func initConfig() {
6867
viper.SetConfigFile(cfgFile)
6968
} else {
7069
// Find home directory.
71-
home, err := homedir.Dir()
70+
home, err := os.UserHomeDir()
7271
cobra.CheckErr(err)
7372

7473
// Search config in home directory with name ".testproject" (without extension).

cobra/tpl/main.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ import (
2727
"os"
2828
"github.com/spf13/cobra"
2929
{{ if .Viper }}
30-
homedir "github.com/mitchellh/go-homedir"
3130
"github.com/spf13/viper"{{ end }}
3231
)
3332
@@ -81,7 +80,7 @@ func initConfig() {
8180
viper.SetConfigFile(cfgFile)
8281
} else {
8382
// Find home directory.
84-
home, err := homedir.Dir()
83+
home, err := os.UserHomeDir()
8584
cobra.CheckErr(err)
8685
8786
// Search config in home directory with name ".{{ .AppName }}" (without extension).

0 commit comments

Comments
 (0)