Hands-On System Programming with Go
上QQ阅读APP看书,第一时间看更新

Composite types

Beside the basic types, there are others, which are known as composite types. These are as follows:

 

The empty interface, interface{}, is a generic type that can contain any value. Since this interface has no requirements (methods), it can be satisfied by any value.

Interfaces, pointers, slices, functions, channels, and maps can have a void value, which is represented in Go by nil:

  • Pointers are self-explanatory; they are not referring to any variable address.
  • The interface's underlying value can be empty.
  • Other pointer types, like slices or channels, can be empty.