Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use os.UserHomeDir #1706

Merged
merged 2 commits into from Mar 31, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 1 addition & 2 deletions cmd/notices.go
Expand Up @@ -11,7 +11,6 @@ import (
"strings"
"time"

"github.com/mitchellh/go-homedir"
log "github.com/sirupsen/logrus"
)

Expand Down Expand Up @@ -136,7 +135,7 @@ func etagPath() string {
var xdgCache string
var ok bool
if xdgCache, ok = os.LookupEnv("XDG_CACHE_HOME"); !ok || xdgCache == "" {
if home, err := homedir.Dir(); err == nil {
if home, err := os.UserHomeDir(); err == nil {
xdgCache = filepath.Join(home, ".cache")
} else if xdgCache, err = filepath.Abs("."); err != nil {
log.Fatal(err)
Expand Down
3 changes: 1 addition & 2 deletions cmd/root.go
Expand Up @@ -15,7 +15,6 @@ import (
"github.com/adrg/xdg"
"github.com/andreaskoch/go-fswatch"
"github.com/joho/godotenv"
"github.com/mitchellh/go-homedir"
gitignore "github.com/sabhiram/go-gitignore"
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
Expand Down Expand Up @@ -95,7 +94,7 @@ func Execute(ctx context.Context, version string) {
}

func configLocations() []string {
home, err := homedir.Dir()
home, err := os.UserHomeDir()
if err != nil {
log.Fatal(err)
}
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Expand Up @@ -19,7 +19,6 @@ require (
github.com/julienschmidt/httprouter v1.3.0
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51
github.com/mattn/go-isatty v0.0.18
github.com/mitchellh/go-homedir v1.1.0
github.com/moby/buildkit v0.11.5
github.com/moby/patternmatcher v0.5.0
github.com/opencontainers/image-spec v1.1.0-rc2
Expand Down Expand Up @@ -57,6 +56,7 @@ require (
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-runewidth v0.0.14 // indirect
github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/mitchellh/mapstructure v1.1.2 // indirect
github.com/moby/sys/sequential v0.5.0 // indirect
github.com/moby/term v0.0.0-20200312100748-672ec06f55cd // indirect
Expand Down
3 changes: 1 addition & 2 deletions pkg/runner/run_context.go
Expand Up @@ -17,7 +17,6 @@
"runtime"
"strings"

"github.com/mitchellh/go-homedir"
"github.com/opencontainers/selinux/go-selinux"
log "github.com/sirupsen/logrus"

Expand Down Expand Up @@ -309,8 +308,8 @@
}
}
if len(cpath) == 0 {
cpath = rc.JobContainer.DefaultPathVariable()
}

Check warning on line 312 in pkg/runner/run_context.go

View check run for this annotation

Codecov / codecov/patch

pkg/runner/run_context.go#L311-L312

Added lines #L311 - L312 were not covered by tests
(*env)[path] = cpath
}
(*env)[path] = rc.JobContainer.JoinPathVariable(append(rc.ExtraPath, (*env)[path])...)
Expand Down Expand Up @@ -359,7 +358,7 @@
var xdgCache string
var ok bool
if xdgCache, ok = os.LookupEnv("XDG_CACHE_HOME"); !ok || xdgCache == "" {
if home, err := homedir.Dir(); err == nil {
if home, err := os.UserHomeDir(); err == nil {
xdgCache = filepath.Join(home, ".cache")
} else if xdgCache, err = filepath.Abs("."); err != nil {
log.Fatal(err)
Expand Down Expand Up @@ -754,7 +753,7 @@
func setActionRuntimeVars(rc *RunContext, env map[string]string) {
actionsRuntimeURL := os.Getenv("ACTIONS_RUNTIME_URL")
if actionsRuntimeURL == "" {
actionsRuntimeURL = fmt.Sprintf("http://%s:%s/", rc.Config.ArtifactServerAddr, rc.Config.ArtifactServerPort)

Check warning on line 756 in pkg/runner/run_context.go

View check run for this annotation

Codecov / codecov/patch

pkg/runner/run_context.go#L756

Added line #L756 was not covered by tests
}
env["ACTIONS_RUNTIME_URL"] = actionsRuntimeURL

Expand Down