package
module
Version:
v0.3.0
Opens a new window with list of versions in this module.
Published: Sep 20, 2022
License: MIT
Opens a new window with license information.
Imports: 7
Opens a new window with list of imports.
Imported by: 12
Opens a new window with list of known importers.
README
¶
Documentation
¶
Package source 提供与 Go 源码相关的一些操作
CurrentDir 获取`调用者`所在的目录
相当于部分语言的 __DIR__
CurrentFile 获取`调用者`所在的文件
相当于部分语言的 __FILE__
CurrentFunction 获取`调用者`所在的函数名
相当于部分语言的 __FUNCTION__
CurrentLine 获取`调用者`所在的行
相当于部分语言的 __LINE__
func CurrentLocation() (path string, line int)
CurrentLocation 获取调用者当前的位置信息
CurrentPath 获取`调用者`所在目录的路径
类似于部分语言的的 __DIR__ + "/" + path
DumpGoSource 输出 Go 源码到 path
会对源代码作格式化。
func Stack(skip int, msg ...interface{}) string
Stack 返回调用者的堆栈信息
skip 需要忽略的内容。
- 1 表示 Stack 自身;
- 2 表示 Stack 的调用者,以此类推;
msg 表示需要输出的额外信息;
Source Files
¶
Click to show internal directories.
Click to hide internal directories.