klog_file_others.go 241 B

12345678910111213141516171819
  1. //go:build !windows
  2. // +build !windows
  3. package klog
  4. import (
  5. "os/user"
  6. )
  7. func getUserName() string {
  8. userNameOnce.Do(func() {
  9. current, err := user.Current()
  10. if err == nil {
  11. userName = current.Username
  12. }
  13. })
  14. return userName
  15. }