Here we go again, I know what you might be thinking. “This guy was ranting about how Node.js Sucks a while ago and now he is on about Golang.” – sounds like what you were thinking?
Although I loved the move from Node.js to Golang initially and started using Go for pretty much everything I built, I soon found out about its con’s and ran into issues I should not have. Here are some of the reasons I think Golang sucks:
interface
s to do what you want to do with generics, the amount of boilerplate code you have to write will get tedious.struct
system works great, however creating structs all over the place might feel tedious compared to something like Object
s in JavaScript. Even though those two are two different concepts, getting the same thing done in Golang seems to take much more boilerplate work than lets say Node.js or most other languages.URL
based dependency imports, which means you can just do go get http://github.com/somename/somelibrary
and import it to your package with import github.com/somename/somelibrary
, there is no way to specify what exact version of the library you want. Since Golang is compiled, you probably don’t have to worry about your production app crashing because of some of your dependency updating by itself, you will still have to be careful while distributing the source code so that someone else that tries to compile it doesn’t get a version of your dependency that does is not backward compatible with the one you were using originally. Also lack of a central package manager like npm
does not help in this case (although having one has it’s own con’s).URL
based packaging structure, you will have to manually rename all the imports from all the files of the package you are forking to match your new URL
if the project imports other packages from itself. Then when you are done working on it, before you send a pull request, you will have to change everything back again. This can be a pain and even though there are workarounds to this it might not be ovious right away to most people beginning with Golang. I have created a little tool called gomove that should help with this.Now although all of the issues I mentioned above have workarounds, to a beginner just starting in Golang they might cause some headaches. Hopefully the Golang team will leave the language politics behind and start implementing and fixing things (like generics support) as Go matures.
A while ago, for some reason I was on this weird quest to find the perfect programming language that I can master and use for everything. Soon, I learnt that no language is perfect and for a reason. Every language is tailored to be used for specific use cases and if language maintaners started focusing on making the language work in every possible scenario, it will turn into a huge mess (im looking at you JavaScript).
This does not mean I am completely abandoning Golang. Now, I use whatever I feel most productive in for the type of application I am working on. If I am working on a API or simple website, I usually use Node.js since it lets me bootstrap a web based application really quick. If I am working on a command line tool or some networked service, I use Golang. Heck, I even use PHP and WordPress for some things.
For people who were like me and are looking for that one perfect language to learn and use on everything, stop looking, you are just wasting your time. Just use whatever you feel the most comfortable in and don’t hesitate to learn new technologies and languages. You will be much more productive this way, rather than trying to build a house with paper. The big lesson I learn’t was to use the right tool for the right job instead of looking for a swiss army knife.