Skip to main content
Journey Uncommon Logo
JourneyUncommon
hardGointerface representation iface itabSingle-choice MCQ

What does this print, and why does it surprise people who think a nil concrete pointer makes a nil interface?

type MyErr struct{} func (*MyErr) Error() string { return "x" } func do() error { var p *MyErr = nil return p } func main() { err := do() fmt.Println(err == nil) }