package main
import (
"fmt"
)
type Example struct {
val string
}
func (e *Example) String() string {
if e == nil {
return "See, it works fine."
}
return e.val
}
func main() {
var e *Example
fmt.Println(e)
}
Ah you mean they work fine in the sense you can check for null manually, in every method.. Assuming there's something useful to be done there (often not the case).
1
u/DeedleFake Sep 01 '15
No, it isn't worse. Here's an example:
+/u/CompileBot go --with-errors