From e0f41be1bfb8d5f961fab0ba46d7ab1fffdaea0d Mon Sep 17 00:00:00 2001 From: umarcor Date: Fri, 7 Jun 2019 21:48:51 +0200 Subject: [PATCH] drop mitchellh/go-homedir (#853) --- README.md | 4 +--- cobra/cmd/root.go | 4 ++-- cobra/cmd/testdata/root.go.golden | 3 +-- cobra/tpl/main.go | 3 +-- go.mod | 1 - go.sum | 2 -- 6 files changed, 5 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index d143e323d..eb62cede6 100644 --- a/README.md +++ b/README.md @@ -195,7 +195,6 @@ import ( "fmt" "os" - homedir "github.com/mitchellh/go-homedir" "github.com/spf13/cobra" "github.com/spf13/viper" ) @@ -241,14 +240,13 @@ func initConfig() { viper.SetConfigFile(cfgFile) } else { // Find home directory. - home, err := homedir.Dir() + home, err := os.UserHomeDir() cobra.CheckErr(err) // Search config in home directory with name ".cobra" (without extension). viper.AddConfigPath(home) viper.SetConfigName(".cobra") } - viper.AutomaticEnv() if err := viper.ReadInConfig(); err == nil { diff --git a/cobra/cmd/root.go b/cobra/cmd/root.go index f27ae7e6c..aafbde207 100644 --- a/cobra/cmd/root.go +++ b/cobra/cmd/root.go @@ -15,8 +15,8 @@ package cmd import ( "fmt" + "os" - homedir "github.com/mitchellh/go-homedir" "github.com/spf13/cobra" "github.com/spf13/viper" ) @@ -62,7 +62,7 @@ func initConfig() { viper.SetConfigFile(cfgFile) } else { // Find home directory. - home, err := homedir.Dir() + home, err := os.UserHomeDir() cobra.CheckErr(err) // Search config in home directory with name ".cobra" (without extension). diff --git a/cobra/cmd/testdata/root.go.golden b/cobra/cmd/testdata/root.go.golden index be040365b..e79bd7219 100644 --- a/cobra/cmd/testdata/root.go.golden +++ b/cobra/cmd/testdata/root.go.golden @@ -20,7 +20,6 @@ import ( "os" "github.com/spf13/cobra" - homedir "github.com/mitchellh/go-homedir" "github.com/spf13/viper" ) @@ -68,7 +67,7 @@ func initConfig() { viper.SetConfigFile(cfgFile) } else { // Find home directory. - home, err := homedir.Dir() + home, err := os.UserHomeDir() cobra.CheckErr(err) // Search config in home directory with name ".testproject" (without extension). diff --git a/cobra/tpl/main.go b/cobra/tpl/main.go index 0b9c6610e..7d60fdd37 100644 --- a/cobra/tpl/main.go +++ b/cobra/tpl/main.go @@ -27,7 +27,6 @@ import ( "os" "github.com/spf13/cobra" {{ if .Viper }} - homedir "github.com/mitchellh/go-homedir" "github.com/spf13/viper"{{ end }} ) @@ -81,7 +80,7 @@ func initConfig() { viper.SetConfigFile(cfgFile) } else { // Find home directory. - home, err := homedir.Dir() + home, err := os.UserHomeDir() cobra.CheckErr(err) // Search config in home directory with name ".{{ .AppName }}" (without extension). diff --git a/go.mod b/go.mod index eb7d47fa5..3da58c39a 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,6 @@ go 1.14 require ( github.com/cpuguy83/go-md2man/v2 v2.0.0 github.com/inconshreveable/mousetrap v1.0.0 - github.com/mitchellh/go-homedir v1.1.0 github.com/spf13/pflag v1.0.5 github.com/spf13/viper v1.7.0 gopkg.in/yaml.v2 v2.4.0 diff --git a/go.sum b/go.sum index 9328ee3ee..c9489731f 100644 --- a/go.sum +++ b/go.sum @@ -119,8 +119,6 @@ github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5 github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= -github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= -github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI= github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS42BGNg= github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY=