So I just got done evaluating a bunch of golang-challenge submissions. It was a blast reading and seeing everyone’s solutions but I am going echo what Jeff Allen said. Go is definitely not free of WTF moments.
I don’t know what people code in. If you want me to mock you, tell me you work in an IDE like IntelliJ.
Vim is the best for coding Go in my opinion. Unless you are like Dominik
who loves his emacs which is acceptable. If you left your terminal, you are doing it wrong. The moral
of the story is that Vim has vim-go which is amazing. You can
GoErrCheck. Its amazing how easy it makes
everything. If you don’t use Vim, then use the cli.
If you are really lazy like me, check out Gometalinter.
Domink pointed out in his post with his thoughts, that you should consider how you name variables. Seriously, take this to heart. The less importance of a variable, the shorter the name. SINGLE LETTERS ARE OK! If that bugs you, get over it. You will grow to love it. Remember when you took a math class and you had a function that took the value X? Its like that. Draw attention to the things that matter.
Seriously, don’t use multiple files unless you exceed 300 lines. I would rather scan one file around 300 lines then 10 files with 30 lines. Just saying, I did it at first and learned that as well. This is average. There is nothing wrong with small files for when it makes sense but when solving one problem and writing a small app, usually one file is better. 300 lines is about my limit when I start asking if I should break the file up or refactor. Again, this is my opinion and other people have theirs.Robert pointed out in the comments that it should remain logical and that is correct FWIW.
Last but not least, if you haven’t already; please read Effective Go. Its really a good read and gives some really good guidelines.