mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-12-20 23:46:23 +01:00
20 lines
241 B
Go
20 lines
241 B
Go
|
//go:build !windows
|
||
|
// +build !windows
|
||
|
|
||
|
package klog
|
||
|
|
||
|
import (
|
||
|
"os/user"
|
||
|
)
|
||
|
|
||
|
func getUserName() string {
|
||
|
userNameOnce.Do(func() {
|
||
|
current, err := user.Current()
|
||
|
if err == nil {
|
||
|
userName = current.Username
|
||
|
}
|
||
|
})
|
||
|
|
||
|
return userName
|
||
|
}
|