package main
import ("fmt";"runtime")
golang 的runtime库,提供Caller函数,可以返回运行时正在执行的文件名和行号:
函数定义:
func Caller(skip int) (pc uintptr, file string, line int, ok bool
Go打印函数名/文件名/行号
最新推荐文章于 2023-11-28 22:57:48 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)
package main
import ("fmt";"runtime")
golang 的runtime库,提供Caller函数,可以返回运行时正在执行的文件名和行号:
函数定义:
func Caller(skip int) (pc uintptr, file string, line int, ok bool