Skip to content

Commit a85afd5

Browse files
committed
chore(deps): drop mitchellh/go-homedir for stdlib os.UserHomeDir
mitchellh/go-homedir is archived upstream. Its homedir.Dir() is effectively equivalent to os.UserHomeDir() (stdlib since Go 1.12) on Linux/macOS/Windows. The only practical behavioral delta is on Unix with HOME unset: go-homedir falls back to /etc/passwd via os/user; stdlib returns an error instead. That path already log.Fatals with the error, so the user-visible outcome is equivalent. Also evaluated blang/semver v3 -> v4 in this pass but reverted: the v3 import path is pinned transitively by rhysd/go-github-selfupdate (selfupdate.Release.Version is blang/semver v3). A clean v4 migration requires first replacing the selfupdate library.
1 parent 468cde3 commit a85afd5

4 files changed

Lines changed: 2 additions & 9 deletions

File tree

core/environment/env.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ import (
44
"log"
55
"os"
66
"strings"
7-
8-
homedir "github.com/mitchellh/go-homedir"
97
)
108

119
var envFiles = []string{".env.local", ".env"}
@@ -19,7 +17,7 @@ func InitEnvironmentVariables(envStorage EnvStorage) {
1917
err error
2018
)
2119

22-
homeDir, err = homedir.Dir()
20+
homeDir, err = os.UserHomeDir()
2321
if err != nil {
2422
log.Fatal("Could not evaluate HOME directory - ", err)
2523
}

core/environment/env_test.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ import (
55
"path/filepath"
66
"strings"
77
"testing"
8-
9-
homedir "github.com/mitchellh/go-homedir"
108
)
119

1210
func TestInitEnvironmentVariables(t *testing.T) {
@@ -24,7 +22,7 @@ func TestInitEnvironmentVariables(t *testing.T) {
2422

2523
InitEnvironmentVariables(f)
2624

27-
homeDir, _ := homedir.Dir()
25+
homeDir, _ := os.UserHomeDir()
2826

2927
if envHomeDir := f.Envs["HOME"]; envHomeDir != homeDir {
3028
t.Errorf("expecting $HOME value '%s', got '%s'", homeDir, envHomeDir)

go.mod

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ require (
1313
github.com/gookit/color v1.6.0
1414
github.com/jedib0t/go-pretty/v6 v6.7.9
1515
github.com/leaanthony/debme v1.2.1
16-
github.com/mitchellh/go-homedir v1.1.0
1716
github.com/moby/term v0.5.2
1817
github.com/onsi/gomega v1.7.0 // indirect
1918
github.com/rhysd/go-github-selfupdate v1.2.3

go.sum

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,6 @@ github.com/mattn/go-runewidth v0.0.23/go.mod h1:XBkDxAl56ILZc9knddidhrOlY5R/pDhg
8080
github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE=
8181
github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d h1:5PJl274Y63IEHC+7izoQE9x6ikvDFZS2mDVS3drnohI=
8282
github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE=
83-
github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y=
84-
github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
8583
github.com/moby/term v0.5.2 h1:6qk3FJAFDs6i/q3W/pQ97SX192qKfZgGjCQqfCJkgzQ=
8684
github.com/moby/term v0.5.2/go.mod h1:d3djjFCrjnB+fl8NJux+EJzu0msscUP+f8it8hPkFLc=
8785
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs=

0 commit comments

Comments
 (0)