software/golang

Go Programming Language

defer

defer pushes a function call on to a local stack to be executed when the enclosing function returns (either normally or due to a panic). The arguments are evaluated at the time/position of the defer call, not when the defered function itself is called (this is intuitive).

The golang documentation gives the examples of closing file handles and printing HTML footers (defer right after printing the header).

Language Notes

complex64 and complex128 are built-in numeric types. rune is also built-in.

Capitalization controls visibility. Everything is visible within a package; only upper-case things are visible outside the package.

All types have a “zero value” which they are automatically initialized with if not defined otherwise. These include false for boolean, 0 for numerics, empty string, and nil in many cases. This recurses down in to structs, collections, etc.

TODO: capitalization of struct fields

Learning Resources

In addition to the excellent dynamic Tour, documentation, and other things listed on the golang.org front page:

Other Resources

  • GoCI (continuous integration)