github.com/cloudwego/runtimex@v0.1.0/README.md (about) 1 # runtimex 2 3 Runtimex package help to expose Go Runtime internals representation safely. 4 5 ## Usage 6 7 ### Get Goroutine ID 8 9 ```go 10 gid, err := runtimex.GID() 11 ``` 12 13 ### Get Processor ID 14 15 ```go 16 pid, err := runtimex.PID() 17 ``` 18 19 ## Note 20 21 Since we use a hack way to expose internal representation of the Go runtime, so if Go change some internal variable names, the package will return error. 22 23 You should care about the error returned by runtimex and do the fallback logic If necessary. 24 25 For now, we only depend on `runtime.g` and `g.goid`.