mirror of
https://github.com/davidallendj/magellan.git
synced 2025-12-20 11:37:01 -07:00
chore: refactored getting username
This commit is contained in:
parent
1d9dbe7b7f
commit
aecb56971d
2 changed files with 13 additions and 6 deletions
|
|
@ -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 ""
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue