Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.


Code Block
type myError struct{}

func (myError) Error() string { return "error" }

func F() myError { return myError{} }

var _e error = F()
// F returns an object of type myError but we want error, an interface.

Use Field Names to initialize Structs