mirror of
https://github.com/chai2010/advanced-go-programming-book.git
synced 2025-05-24 12:32:21 +00:00
26 lines
330 B
Go
26 lines
330 B
Go
package gls
|
|
|
|
import (
|
|
"reflect"
|
|
)
|
|
|
|
func getg() interface{}
|
|
|
|
type eface struct {
|
|
_type, elem uintptr
|
|
}
|
|
|
|
//go:nosplit
|
|
func runtime_convT2E_hack(_type, elem uintptr) eface {
|
|
return eface{
|
|
_type: _type,
|
|
elem: elem,
|
|
}
|
|
}
|
|
|
|
func GetGoid() int64 {
|
|
g := getg()
|
|
goid := reflect.ValueOf(g).FieldByName("goid").Int()
|
|
return goid
|
|
}
|