Skip to content

Commit 8eaca5f

Browse files
umarcorspf13
authored andcommitted
drop mitchellh/go-homedir (#853)
1 parent ace6b14 commit 8eaca5f

File tree

6 files changed

+5
-11
lines changed

6 files changed

+5
-11
lines changed

cobra/cmd/root.go

+2-2
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

+1-2
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

+1-2
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).

go.mod

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ go 1.14
55
require (
66
github.com/cpuguy83/go-md2man/v2 v2.0.0
77
github.com/inconshreveable/mousetrap v1.0.0
8-
github.com/mitchellh/go-homedir v1.1.0
98
github.com/spf13/pflag v1.0.5
109
github.com/spf13/viper v1.8.0
1110
gopkg.in/yaml.v2 v2.4.0

go.sum

-2
Original file line numberDiff line numberDiff line change
@@ -185,8 +185,6 @@ github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNx
185185
github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg=
186186
github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc=
187187
github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
188-
github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y=
189-
github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
190188
github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI=
191189
github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS42BGNg=
192190
github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY=

user_guide.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ import (
7676
"fmt"
7777
"os"
7878

79-
homedir "github.com/mitchellh/go-homedir"
8079
"github.com/spf13/cobra"
8180
"github.com/spf13/viper"
8281
)
@@ -122,7 +121,7 @@ func initConfig() {
122121
viper.SetConfigFile(cfgFile)
123122
} else {
124123
// Find home directory.
125-
home, err := homedir.Dir()
124+
home, err := os.UserHomeDir()
126125
cobra.CheckErr(err)
127126

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

0 commit comments

Comments
 (0)