justyntemme / goMonitor

Monitor Your Server from a webpage
BSD 2-Clause "Simplified" License
11 stars 6 forks source link

Always lint, vet, and fmt code #3

Open jcbwlkr opened 8 years ago

jcbwlkr commented 8 years ago

Hello, @justyntemme! I found this project from your post on Reddit. I thought I would offer a few pieces of advice by filing a couple of issues. Feel free to follow or close them as you see fit.

The thing I would immediately say is to ensure your editor is always running gofmt (or better yet goimports) every time you save your code. The beauty of gofmt is that the entire Go community can have unified code style without bikeshedding over things like brace placement. As the proverb goes

Gofmt's style is no one's favorite, yet gofmt is everyone's favorite.

Additionally there are a few issues brought up by golint. Your editor should also be configured to run this on save and report the results.

Finally even though it doesn't report anything you should also be running go vet on save.

Cheers!

justyntemme commented 8 years ago

Thanks for stopping by! I will be reading through the issues today and seeing if i can't knock a few out. Appreciate you writing this up. I use normal old vim to do all my programming, but i have heard of golang for vim. I'll check it out.

EDIT: Leaving this issue open as anyone looking to submit a pull request should look over this. Great info

loffa commented 8 years ago

I would recomend fatih/vim-go for coding go in Vim.

It can be configured to auto-fmt, auto-lint and even auto-import packages.

justyntemme commented 8 years ago

I have used vim-go previously just have yet to set it up on my new install. Great tool for working with go and can get packages from within vim without ever leaving your file.