Fix `golint` and `go vet` errors, removes a couple of magic numbers. Flatten nested ifs.

Hello Shopify,

I've fixed a couple of [golint][1] and [go vet][2] errors (aside from missing comments on exported fields).  I've also worked on some general things that stood to my eye, like deeply nested if-statements in test cases and some magic numbers - although not all magic numbers.

All the tests are green.  Let me know if you'd prefer a single rebased commit.

[1]: https://github.com/golang/lint
[2]: http://golang.org/cmd/vet/