Skip to content

Commit

Permalink
Use os.UserHomeDir to replace go-homedir
Browse files Browse the repository at this point in the history
os.UserHomeDir was added in Go 1.12. Use it to avoid a non-stdlib
dependency.
  • Loading branch information
tklauser committed May 30, 2022
1 parent a42bc65 commit 56f49f1
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 7 deletions.
2 changes: 0 additions & 2 deletions go.mod
@@ -1,5 +1,3 @@
module github.com/muesli/go-app-paths

go 1.14

require github.com/mitchellh/go-homedir v1.1.0
2 changes: 0 additions & 2 deletions go.sum

This file was deleted.

4 changes: 1 addition & 3 deletions paths.go
Expand Up @@ -4,8 +4,6 @@ import (
"errors"
"os"
"strings"

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

var (
Expand Down Expand Up @@ -159,7 +157,7 @@ func (s *Scope) LookupDataFile(filename string) ([]string, error) {
// expandUser is a helper function that expands the first '~' it finds in the
// passed path with the home directory of the current user.
func expandUser(path string) string {
if u, err := homedir.Dir(); err == nil {
if u, err := os.UserHomeDir(); err == nil {
return strings.Replace(path, "~", u, -1)
}
return path
Expand Down

0 comments on commit 56f49f1

Please sign in to comment.