You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

user.go 392B

1234567891011121314151617
  1. // Copyright 2014 The Gogs Authors. All rights reserved.
  2. // Use of this source code is governed by a MIT-style
  3. // license that can be found in the LICENSE file.
  4. package user
  5. import "os"
  6. // CurrentUsername return current login OS user name
  7. func CurrentUsername() string {
  8. curUserName := os.Getenv("USER")
  9. if len(curUserName) > 0 {
  10. return curUserName
  11. }
  12. return os.Getenv("USERNAME")
  13. }