28 lines · 567 B · Go
RawDownload
// Copyright 2014 The Gogs Authors. All rights reserved.// SPDX-License-Identifier: MIT package user import (	"os"	"os/user") // CurrentUsername return current login OS user namefunc CurrentUsername() string {	userinfo, err := user.Current()	if err != nil {		return fallbackCurrentUsername()	}	return userinfo.Username} // Old method, used if new method doesn't work on your OS for some reasonfunc fallbackCurrentUsername() string {	curUserName := os.Getenv("USER")	if len(curUserName) > 0 {		return curUserName	} 	return os.Getenv("USERNAME")}

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t