Hello

I have a small test like this

package main

type MError struct {

}

func (m *MError) Error() string {
 return "MError"
}

func NewMError() *MError {
 return nil
}

func main() {
 var e error
 e = NewMError()
 println(e.Error())
}



I know that interface actually combine like (Type, value), if I change


func (m *MError) Error() string {


 to 


func (m MError) Error() string {


would lead to "panic: value method main.MError.Error called using nil *MError 
pointer", 

why we have this different behave?


-- 
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