[go-nuts] how to locate the function definition of golang source code?

2017-02-22 Thread Jiajun Huang
Hello, I'm reading golang source code, it's in version 1.8. some times, I got some functions like: (runtime/proc.go, function main): 107 func main() { 108 g := getg() 109 110 // Racectx of m0->g0 is used only as the parent of the main goroutine. 111 // It must not be

[go-nuts] where is the implementation of `getg`?

2018-01-16 Thread Jiajun Huang
Hi, all: I'm reading golang runtime implementation, I've got a function definition: // getg returns the pointer to the current g. // The compiler rewrites calls to this function into instructions // that fetch the g directly (from TLS or from the dedicated register). func getg() *g

[go-nuts] Is there any equivalent `fork` in Golang?

2018-03-07 Thread Jiajun Huang
hello, is there any replacement for `fork` syscall in Golang? I've found: - exec.Command - syscall.ForkExec but `exec.Command` can only execute a out side command. syscall.ForkExec is needless, because what I need is `fork` only. just like the C-way, fork, and return pid, then I entry