Runtimex package help to expose Go Runtime internals representation safely.
gid, err := runtimex.GID()
pid, err := runtimex.PID()
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.
You should care about the error returned by runtimex and do the fallback logic If necessary.
For now, we only depend on runtime.g
and g.goid
.