Interfaces
Typed nil interface values
An interface holding a typed nil pointer has a dynamic type and is not itself nil. Return a literal nil interface on success rather than converting a nil concrete error pointer. Whether a method call on the contained nil pointer is safe depends on its implementation. Example output: 'true false'.
Formal Syntax & Structure
go syntaxgo
var p *T; var i I = pWorking Example
Example Snippetgo
package main
import "fmt"
type Failure struct{}
func (*Failure) Error() string { return "failure" }func main() { var p *Failure var e error = p fmt.Println(p == nil, e == nil)}