• Real type of an interface variable is decided dynamatically
  • Need be careful when comparing interface, panic will occur when real type is not comparable such as slice.
  • nil value assigned to an interface variable is different from nil pointer assigned to a variable
  • Ex. check is argument value nil in function sill get wrong result
  • Do not assign nil pointer to interface. Because dynamic type is not nil but dynapic value is nil, cause dynamic dispatch panic


What to read next

Previous / Next
Previous: Go - Interface Satisfaction - 3 Next: Go - Type Assertion
More like this
Subscribe via RSS: Macro · Tech

Tags:

Updated: