Golang错误解析"runtime error: invalid memory address or nil pointer dereference"
概述从刚上手golang时就经常遇到这个错误,三个月之后对golang有些了解,开始理清一下原因.问题原因varp*Obj某个指针变量声明之后,还没有经过赋值时默认指向nil,直接调用指针就会报错runtimeerror:invalidmemoryaddressornilpointerdereference示例packagemainimport("fmt""math")typePointstruc