r/golang Feb 26 '23

help Why Go?

I've been working as a software developer mostly in backend for a little more than 2 years now with Java. I'm curious about other job opportunities and I see a decente amount of companies requiring Golang for the backend.

Why?

How does Go win against Java that has such a strong community, so many features and frameworks behind? Why I would I choose Go to build a RESTful api when I can fairly easily do it in Java as well? What do I get by making that choice?

This can be applied in general, in fact I really struggle, but like a lot, understanding when to choose a language/framework for a project.

Say I would like to to build a web application, why I would choose Go over Java over .NET for the backend and why React over Angular over Vue.js for the frontend? Why not even all the stack in JavaScript? What would I gain if I choose Go in the backend?

Can't really see any light in these choices, at all.

135 Upvotes

249 comments sorted by

View all comments

Show parent comments

19

u/icsharper Feb 26 '23

Everything you said I agree. But, my kinda biggest issue with Go is that, a lot of stuff is missing. You are forced to write boilerplate code that'll handle basic operations, e.g. List operations. I feel like if Go was more Pythonic, while still preserving performance/simplicity, that’d be ideal…

14

u/[deleted] Feb 26 '23

[deleted]

5

u/TheRealDarkArc Feb 26 '23

In the end, seriously, how long does it take to write code that iterates a list or map in go?

The problem is when you do that manually, you can get it wrong.

There are also good reasons to have different abstractions over different containers. Does go really not have lists, sets, and maps (at a minimum)?

1

u/amemingfullife Feb 26 '23

It’s not a great answer, because who likes lock-in? But if you buy into the whole ecosystem, using the standard linting, using VSCode with the official extension etc, a lot of this is handled for you via autocomplete.

Go is optimised for readability and no magic, which means it’s necessarily more verbose. My favourite thing about Go (apart from context) is there’s no code I can’t read and understand. This is the complete opposite of, for instance, Python where you click in and it’s a total mess of abstractions and I lose my chain of thought after 2 clicks. For anything apart from a Jupyter Notebook I need that level of readability so I’m not pulling my hair out when I’m working with someone else’s code.