RosettaCodeData/Task/Scope-Function-names-and-labels/Go/scope-function-names-and-labels-2.go
2023-07-01 13:44:08 -04:00

17 lines
277 B
Go

package ex
import (
"fmt"
"runtime"
)
// X is exported.
func X(x func()) {
pc, _, _, _ := runtime.Caller(0)
fmt.Println(runtime.FuncForPC(pc).Name(), "calling argument x...")
x()
}
func x() { // not exported, x not upper case.
panic("top level x")
}