Statically Check Nil Interface Values?
<p>Let's say we have the following:</p>

<pre><code>type I interface {
    M()
}

func main() {
    var i I
    i.M()
}
</code></pre>

<p>Why does Go not do some static analysis at compile type to check that the underlying value of the interface is nil and throw a compile time error? Instead we end up throwing a runtime exception at <code>i.M()</code></p>

<p>==================================================================</p>

<p>Output:</p>

<pre><code>panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0xffffffff addr=0x0 pc=0x2004d]

goroutine 1 [running]:
panic(0x13f480, 0x1040a038)
    /usr/local/go/src/runtime/panic.go:481 +0x700
main.main()
    /tmp/sandbox469152264/main.go:12 +0x4d
</code></pre>