Standard library / runtime

runtime.Func.Entry()

Returns the entry PC of the compiled function. Do not treat it as a stable identifier across builds. Expected stdout: 'true\n'.

Formal Syntax & Structure

go syntaxgo
func (f *Func) Entry() uintptr

Return Value

uintptr

Entry program counter.

Working Example

Example Snippetgo
package main
import (  "fmt"  "runtime")
func main() {  pc, _, _, _ := runtime.Caller(0)  f := runtime.FuncForPC(pc)  fmt.Println(f != nil && f.Entry() != 0)}
Go Reference