名称
已收录文章:2篇
-
大家还是直接看代码吧~ // 获取正在运行的函数名 func runFuncName()string{ pc := make([]uintptr,1) runtime.Callers(2,pc) f := runtime.FuncForPC(pc[0]) return f.Name() } package main import( "fmt" "runtime" )412 收藏
-
示例代码: package main import ( "fmt" "path" ) func main() { filename := "device/sdk/CMakeLists.txt" filenameall := path.Base(filename) filesuffix := path.Ext(filename) fileprefix := filenameall[0:len(filenameall) - len379 收藏