chore: refactored getting username

This commit is contained in:
David Allen 2025-04-23 18:31:37 -06:00
parent 1d9dbe7b7f
commit aecb56971d
Signed by: towk
GPG key ID: 0430CDBE22619155
2 changed files with 13 additions and 6 deletions

View file

@ -2,6 +2,7 @@ package util
import (
"fmt"
"os/user"
"time"
)
@ -25,3 +26,11 @@ func CheckUntil(interval time.Duration, timeout time.Duration, predicate func()
}
}
}
func GetCurrentUsername() string {
currentUser, _ := user.Current()
if currentUser != nil {
return currentUser.Username
}
return ""
}