# gotrace **Repository Path**: jscode/gotrace ## Basic Information - **Project Name**: gotrace - **Description**: go function call stack trace - **Primary Language**: Go - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2017-03-04 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README go function call stack trace ### 使用 ``` go get git.oschina.net/jscode/gotrace go build git.oschina.net/jscode/gotrace # gotrace修改go_source_dir目录下的所有go文件,添加写日志的代码,日志文件为/tmp/trace.log。 gotrace go_source_dir ``` ### 实现 通过ast分析go语言代码,在每个函数中插入代码,来跟踪函数调用堆栈。 ``` function main(){ entry("main"); defer exit("main"); } ``` 如何获取 goroutine id,参考 https://github.com/huandu/goroutine