Skip to content

Commit

Permalink
refactor: get rid of mitchellh/go-homedir package
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandear committed Dec 24, 2024
1 parent 7998011 commit 9081f1a
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 7 deletions.
3 changes: 1 addition & 2 deletions cli/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (
"github.com/fatih/color"
"github.com/mgechev/revive/config"
"github.com/mgechev/revive/revivelib"
"github.com/mitchellh/go-homedir"
"github.com/spf13/afero"
)

Expand Down Expand Up @@ -128,7 +127,7 @@ func buildDefaultConfigPath() string {
configFileName := "revive.toml"
configDirFile := filepath.Join(os.Getenv("XDG_CONFIG_HOME"), configFileName)

if homeDir, err := homedir.Dir(); err == nil {
if homeDir, err := os.UserHomeDir(); err == nil {
homeDirFile = filepath.Join(homeDir, configFileName)
}

Expand Down
2 changes: 0 additions & 2 deletions cli/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,13 @@ import (
"path/filepath"
"testing"

"github.com/mitchellh/go-homedir"
"github.com/spf13/afero"
)

func TestMain(m *testing.M) {
os.Unsetenv("HOME")
os.Unsetenv("XDG_CONFIG_HOME")
AppFs = afero.NewMemMapFs()
homedir.DisableCache = true
os.Exit(m.Run())
}

Expand Down
1 change: 0 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ require (
github.com/fatih/structtag v1.2.0
github.com/hashicorp/go-version v1.7.0
github.com/mgechev/dots v0.0.0-20210922191527-e955255bf517
github.com/mitchellh/go-homedir v1.1.0
github.com/olekukonko/tablewriter v0.0.5
github.com/spf13/afero v1.11.0
golang.org/x/mod v0.22.0
Expand Down
2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6T
github.com/mattn/go-runewidth v0.0.16/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
github.com/mgechev/dots v0.0.0-20210922191527-e955255bf517 h1:zpIH83+oKzcpryru8ceC6BxnoG8TBrhgAvRg8obzup0=
github.com/mgechev/dots v0.0.0-20210922191527-e955255bf517/go.mod h1:KQ7+USdGKfpPjXk4Ga+5XxQM4Lm4e3gAogrreFAYpOg=
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/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec=
github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
Expand Down

0 comments on commit 9081f1a

Please sign in to comment.