修改go1.12.6版本的编译器代码 编辑src/runtime/proc.go文件,在尾部添加函数Goid: func Goid() int64 { _g_ := getg() return _g_.goid } 调用方法 runtime.Goid() https://blog.csdn.net/weiyuefei/article/details/77500653