Improves code quality

* Adds missing error check error (goerrchecheck), and associated tests
* Some golint -ing
* Used goimports for all import