How to known a function of a interface is not realized? [duplicate]
问题 This question already has answers here : Go reflection with interface embedded in struct - how to detect “real” functions? (5 answers) Closed last year . I just tried the following code in Go. package main type inter interface { aaa() int } type impl struct { inter } func main() { var a inter a = impl{} // how to check the function for interface `inter` is not realized? a.aaa() } It can be go build and go run . But will receive a panic like: panic: runtime error: invalid memory address or nil