4 ms·
> Go basically forces you to have clean code all along, > which is a bit like forcing a scientist to wipe down the > workbench and rinse all the beakers between
by nnx 12y ago
> Go basically forces you to have clean code all along,
> which is a bit like forcing a scientist to wipe down the
> workbench and rinse all the beakers between every experiment,
>or forcing a writer to run the spell checker after every cigarette.
As usage of gofmt is idiomatic Go, simply using the superset goimports handles all of this for you.
Sure, any language has tools to reformat code for you in some magic ways - but what makes Go special is that it takes this kind of tooling seriously enough by making it standard right out-of-the-box and right when initiating new users to the language (notice the [Format] button on the first slide of the official Go tutorial http://tour.golang.org/welcome/1 http://tour.golang.org/welcome/1 ).
https://github.com/bradfitz/goimports https://github.com/bradfitz/goimports
http://michaelwhatcott.com/gosublime-goimports/ http://michaelwhatcott.com/gosublime-goimports/
Nevertheless, this new article from Evan is a marvel, a must-read, as usual.
- swah 12y agogo fmt could be a tool that transformed "sloppy Go" (unused imports, variable redeclarations...) into formal Go before compiling...