aboutsummaryrefslogtreecommitdiff
path: root/internal/osutil
diff options
context:
space:
mode:
Diffstat (limited to 'internal/osutil')
-rw-r--r--internal/osutil/osutil.go6
-rw-r--r--internal/osutil/osutil_test.go5
2 files changed, 8 insertions, 3 deletions
diff --git a/internal/osutil/osutil.go b/internal/osutil/osutil.go
index 827988a0..3af67570 100644
--- a/internal/osutil/osutil.go
+++ b/internal/osutil/osutil.go
@@ -25,9 +25,9 @@ func IsExist(path string) bool {
// CurrentUsername returns the current system user via environment variables.
func CurrentUsername() string {
- curUserName := os.Getenv("USER")
- if len(curUserName) > 0 {
- return curUserName
+ username := os.Getenv("USER")
+ if len(username) > 0 {
+ return username
}
return os.Getenv("USERNAME")
diff --git a/internal/osutil/osutil_test.go b/internal/osutil/osutil_test.go
index 4c9a2ad7..8c45f5c0 100644
--- a/internal/osutil/osutil_test.go
+++ b/internal/osutil/osutil_test.go
@@ -55,3 +55,8 @@ func TestIsExist(t *testing.T) {
})
}
}
+
+func TestCurrentUsername(t *testing.T) {
+ // Make sure it does not blow up
+ CurrentUsername()
+}