On Sun, Jan 20, 2019 at 2:32 PM 伊藤和也 <kazya.ito.dr...@gmail.com> wrote:
>
> type a interface{
>    m()
> }
>
> type abc int
> func (abc) m() {}
>
> func main() {
>    var v a
>    v.m()
    ^^^^^^

v is nil. It is declared but never assigned a value. You are
dereferencing v to call m, causing nil ptr dereference.


> }
>
> panic: runtime error: invalid memory address or nil pointer dereference
> [signal 0xc0000005 code=0x0 addr=0x0 pc=0x44e236]
>
> --
> You received this message because you are subscribed to the Google Groups 
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to golang-nuts+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to