Fix golint issues

- document functions
- error should be last item in functions that return multiple values
- capitalise as per Go standards (Id -> ID, Html -> HTML)
- Unnecessary `else` clauses when an earlier `return` is in the `if`
  branch