Skip to content

Commit

Permalink
replace github.com/mitchellh/go-homedir by os (#1658)
Browse files Browse the repository at this point in the history
os.UserHomeDir provides a way to get the user's home directory for
different platforms. Using it drops a dependency.

This doesn't tidy up examples/*/go.sum, as they aren't up-to-date
anyway. That should be done separately.
  • Loading branch information
Humm42 authored Jun 22, 2022
1 parent 47261db commit cd2a9ac
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 7 deletions.
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/klauspost/compress v1.13.5
github.com/minio/md5-simd v1.1.0
github.com/minio/sha256-simd v0.1.1
github.com/mitchellh/go-homedir v1.1.0
github.com/rs/xid v1.2.1
github.com/sirupsen/logrus v1.8.1
golang.org/x/crypto v0.0.0-20201216223049-8b5274cf687f
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/minio/md5-simd v1.1.0 h1:QPfiOqlZH+Cj9teu0t9b1nTBfPbyTl16Of5MeuShdK4=
github.com/minio/md5-simd v1.1.0/go.mod h1:XpBqgZULrMYD3R+M28PcmP0CkI7PEMzB3U77ZrKZ0Gw=
github.com/minio/sha256-simd v0.1.1 h1:5QHSlgo3nt5yKOJrC7W8w7X+NFl8cMPZm96iu8kKUJU=
github.com/minio/sha256-simd v0.1.1/go.mod h1:B5e1o+1/KgNmWrSQK08Y6Z1Vb5pwIktudl0J58iy0KM=
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/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
Expand Down
3 changes: 1 addition & 2 deletions pkg/credentials/file_aws_credentials.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import (
"os"
"path/filepath"

homedir "github.com/mitchellh/go-homedir"
ini "gopkg.in/ini.v1"
)

Expand Down Expand Up @@ -62,7 +61,7 @@ func (p *FileAWSCredentials) Retrieve() (Value, error) {
if p.Filename == "" {
p.Filename = os.Getenv("AWS_SHARED_CREDENTIALS_FILE")
if p.Filename == "" {
homeDir, err := homedir.Dir()
homeDir, err := os.UserHomeDir()
if err != nil {
return Value{}, err
}
Expand Down
3 changes: 1 addition & 2 deletions pkg/credentials/file_minio_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import (
"runtime"

jsoniter "github.com/json-iterator/go"
homedir "github.com/mitchellh/go-homedir"
)

// A FileMinioClient retrieves credentials from the current user's home
Expand Down Expand Up @@ -65,7 +64,7 @@ func (p *FileMinioClient) Retrieve() (Value, error) {
if value, ok := os.LookupEnv("MINIO_SHARED_CREDENTIALS_FILE"); ok {
p.Filename = value
} else {
homeDir, err := homedir.Dir()
homeDir, err := os.UserHomeDir()
if err != nil {
return Value{}, err
}
Expand Down

0 comments on commit cd2a9ac

Please sign in to comment.