1 Star 0 Fork 0

唯哈希 / GUtils

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
runtime.go 378 Bytes
一键复制 编辑 原始数据 按行查看 历史
唯哈希 提交于 2023-02-22 19:27 . update
package runtime
import (
"os"
"path/filepath"
"runtime"
)
// Get the current rinning function name
func GetFuncName() string {
pc := make([]uintptr, 1)
runtime.Callers(2, pc)
f := runtime.FuncForPC(pc[0])
return f.Name()
}
// Get the current work directory
func CWD() string {
path, err := os.Executable()
if err != nil {
return ""
}
return filepath.Dir(path)
}
Go
1
https://gitee.com/vhash/gutils.git
git@gitee.com:vhash/gutils.git
vhash
gutils
GUtils
v0.8.1

搜索帮助