| 12345678910111213141516171819202122 |
- // Copyright 2015 - Present, The Gogs Authors. All rights reserved.
- // Copyright 2018 - Present, Gitote. All rights reserved.
- //
- // This source code is licensed under the MIT license found in the
- // LICENSE file in the root directory of this source tree.
- package user
- import (
- "os"
- )
- // CurrentUsername gets user username
- func CurrentUsername() string {
- curUserName := os.Getenv("USER")
- if len(curUserName) > 0 {
- return curUserName
- }
- return os.Getenv("USERNAME")
- }
|