refactor(examples): allow recursive `go build` and `go test`

The examples/ code was poorly organized, with `main()` being
redeclared several times. This could prevent other projects from
using the standard `go build ./...` syntax.