https://github.com/issue9/source
与 Go 源码相关的一些操作
https://github.com/issue9/source
debug go golang source
Last synced: 4 months ago
JSON representation
与 Go 源码相关的一些操作
- Host: GitHub
- URL: https://github.com/issue9/source
- Owner: issue9
- License: mit
- Created: 2020-06-26T11:22:29.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2025-12-04T05:28:11.000Z (6 months ago)
- Last Synced: 2025-12-07T11:47:32.295Z (6 months ago)
- Topics: debug, go, golang, source
- Language: Go
- Homepage: https://pkg.go.dev/github.com/issue9/source
- Size: 88.9 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
source
[](https://github.com/issue9/source/actions?query=workflow%3AGo)
[](https://opensource.org/licenses/MIT)
[](https://codecov.io/gh/issue9/source)

[](https://pkg.go.dev/github.com/issue9/source)
======
source 模块提供了一些与源码相关的功能
- DumpGoSource 输出并格式化 Go 的源代码;
- CurrentFile 相当于部分语言的 `__FILE__`;
- CurrentDir 相当于部分语言的 `__DIR__`;
- CurrentLine 相当于部分语言的 `__LINE__`;
- CurrentFunction 相当于部分语言的 `__FUNCTION__`;
- Stack 返回调用者的堆栈信息;
- ModFile 文件或目录 p 所在模块的 go.mod 内容;
- ModDir 向上查找 p 所在的目录的 go.mod;
- PackagePath 文件或目录 p 所在 Go 文件的导出路径;
安装
----
```shell
go get github.com/issue9/source
```
版权
----
本项目采用 [MIT](http://opensource.org/licenses/MIT) 开源授权许可证,完整的授权说明可在 [LICENSE](LICENSE) 文件中找到。