How to measure test coverage in Go

Note that Go 1.2 (Q4 2013, rc1 is available) will now display test coverage results: One major new feature of go test is that it can now compute and, with help from a new, separately installed “go tool cover” program, display test coverage results. The cover tool is part of the go.tools subrepository. It can be installed by running The cover tool does two things. … Read more

What is an idiomatic way of representing enums in Go?

Quoting from the language specs:Iota Within a constant declaration, the predeclared identifier iota represents successive untyped integer constants. It is reset to 0 whenever the reserved word const appears in the source and increments after each ConstSpec. It can be used to construct a set of related constants: Within an ExpressionList, the value of each … Read more