diff --git a/.changelog/4f325261c632499cb3f4464799763f58.json b/.changelog/4f325261c632499cb3f4464799763f58.json new file mode 100644 index 00000000000..c440d7cd745 --- /dev/null +++ b/.changelog/4f325261c632499cb3f4464799763f58.json @@ -0,0 +1,8 @@ +{ + "id": "4f325261-c632-499c-b3f4-464799763f58", + "type": "bugfix", + "description": "Updates `config` module to use os.UserHomeDir instead of hard coded environment variable for OS. [#1563](https://github.com/aws/aws-sdk-go-v2/pull/1563)", + "modules": [ + "config" + ] +} \ No newline at end of file diff --git a/config/shared_config.go b/config/shared_config.go index b82926df976..ca48df8794c 100644 --- a/config/shared_config.go +++ b/config/shared_config.go @@ -6,7 +6,6 @@ import ( "fmt" "os" "path/filepath" - "runtime" "strings" "time" @@ -1051,12 +1050,9 @@ func (e CredentialRequiresARNError) Error() string { } func userHomeDir() string { - if runtime.GOOS == "windows" { // Windows - return os.Getenv("USERPROFILE") - } - - // *nix - return os.Getenv("HOME") + // Ignore errors since we only care about Windows and *nix. + homedir, _ := os.UserHomeDir() + return homedir } func oneOrNone(bs ...bool) bool {