Should I learn Go?

I have been a developer for around 10 years.
In the last few years I've been using especially Javascript and Scala for web development and data processing, I love functional programming.
There is a huge hype now around Go and the popularity is growing.
I am thinking giving it a "go" :P

Let me know what you think, pros/cons, anything...

Did you find this post useful? Show some love!
DISCUSSION (37)

My situation was quite similar to you, I was born for this question.

Overall had about 8 years experience at the time, about 4 of which was Scala.

I really love(d) Scala, wonderfully expressive, so much to learn about category theory and generally how to write software in a very "sound" way.

But it's not without it's problems right? It's hard in a big team because it's a difficult language where there are about 10 ways to write something. A lot of bikeshedding will occur on teams when one side thinks you should use Akka, another play, etc etc. Plus the compilation times are quite slow and the tooling around it is difficult and awkward (sbt).

The project I was working on had a fairly extensive test suite, coupled with the compilation times I could be waiting 15 minutes for a full build.

Whilst playing foosball was fun I eventually started learning Go in between the builds. (yes, really!)

Go, for better or worse is almost the opposite of Scala

  • The tooling is extremely good. It's simple to build, test, format, document and benchmark software. Deployment is also very easy
  • The compilation times are very fast. Feedback loops are excellent
  • The standard library is simple and thoughtful. The Scala standard library is pretty good to be fair, but there are so many options for making a web server for instance. In Go it is all built in, you can get extremely far with the stdlib (including testing).
  • This is very beneficial coupled with the backward compatability guarantee because it means there are lots of high quality tutorials that will always be correct. No longer looking at old tutorials around Play! In addition no pain of lack of binary comaptability of libraries when upgrading language versions which i recall being extremely annoying when going from scala 2.8 to 2.10!
  • The language is very simple. There's a very small amount of keywords and constructs compared to Scala
  • Interface resolution is impliclit. You dont say "My Foo implements bar", if your foo has the correct methods it just does. This turns out to be quite nice.

So what's it like for a Scala developer writing Go?

You'll love the feedback loops, but you'll hate writing loops. There's no generics (yet, but they are planned) so you have to write a lot of code you wouldn't have to in Scala.

The ability to build abstractions is far lower than Scala. So you'll end up writing what you'll consider boilerplate. Still you'll end up writing a lot less than you think because the standard library is excellent. Compared to the baggage around the JDK and whatever libraries you choose to bring in the overall cognitive load is a lot lower

Have a look at this todo server code

This is something I hacked together last week. Yes there are for loops. But that is all the code that is needed. You can build that one file and deploy it and you have your web server. No dependencies. All very standard Go that you can find tutorials on how to write it. I didn't have to think at all.

For me, learning Go made me re-evaluate what's important about a programming language. Syntax and expressiveness like in Scala are nice traits and have their uses but a language's ecosystem has a much bigger impact on your ability to just ship stuff. To this day I still have more experience writing Scala than Go but if I was making a product for myself I would pick Go in a heartbeat because it just makes producing robust, fast and simple to maintain software easy

I read somewhere that Go developers "just get the shit done".
By reading your comment I can understand that this is actually the reality.
Sounds like that we are very much a like experience wise and I am totally familiar with what you describe.

Thanks!

When you ask this sort of question, you're likely to get two types of responses:

Developers for whom Go is a pet language. They'll love it; they'll go on and on about how wonderful it is. Don't get me wrong, I'm sure all the sterling qualities they tell you about will be totally 100% true. Thing is they won't mention the sharp edges and/or the places where the language isn't so great.

The other responses you're likely to get are those who despise Go for whatever reason. They'll point out all the weaknesses of the language--"No interfaces? Are you f***ing joking?"--stuff of that sort. I don't think they'll give you much of a balanced and considered response either.

In short while I understand the desire to figure out if it's worth your time to invest in Go, I think posting the question here is probably the least good way to figure out if it's worth your time. Play with Exercism.io. Look at the number (and quality) of questions asked about the language on Stack Overflow. Try to write something beyond the typical "Hello World" with it and see how it feels.

I have found over the years that chasing the new hotness when it comes to programming language is really a fool's errand. No one knows what will prosper, what will become a footnote and what we all wish would die off already (VB6 anyone?) Learning new stuff is definitely great and I totally agree with you on that. But trying to decide what you should learn based on what's "the next big thing" is sort of foolish. I can't tell you what I'll be working on six months from now. It takes years for a language to develop enough of a following for there to be good jobs writing it. Therefore I think trying to predict what's worth learning based on future job prospects dictates that <sarcasm> we keep on with C# and Java </sarcasm> unless we're really willing to play the long game.

Just my humble opinions of course.

Actually I was looking for the extremists to show up. This way you learn the most about the best and worse of the language.

The language isn't going to change much from what it is now. They will add generics and improve error handling. They will finalize the packaging system. That's it. Don't expect it to change for many years.

:) Then I suspect you're already getting what you wanted!

Go is definitely going to be a big deal for years to come.

I also feel like the Go ecosystem touches on much of the most cutting edge techniques in distributed systems, so I feel like learning it gets you closer to some really interesting things (which pay a lot!)

Gophercon also looks like one of the great software conferences.

I know some Go and have enjoyed the basic experience, but I can't speak too much to the actual language other than second-hand accounts. Haven't gotten that deep.

Could you give an example to cutting edge techniques? Like event sourcing and such?

If you've not learned a system level language before, like C or C++, then learning Go is probably a good idea. I have no idea what the language is like, but I'm assuming it exposes concepts you've not yet been exposed to. Even if you end up not using Go, learning new concepts will help you in whatever direction you go.

Don't pick it for hype though. Pick it for learning. And don't hesitate to drop it if isn't helping you in some way.

I have been a C++ programmer for a few years so I know what system level language is like and the whole concept, I actually I like it.

I am not choosing Go because of the hype, I am trying to figure out if there is something behind this hype. The one thing that really caught my eyes is the amazing performance of Go due to the fact it's a system level language.

Don't pick it for hype though. Pick it for learning. And don't hesitate to drop it if isn't helping you in some way.

That's what I did, I steered clear of it for a long time because of the hype, now I'm still unsure if I like it because I like it or if I like it because I'm learning something different from the day to day. I'll get to the answer eventually

I think you should learn Go as it's the exact opposite of Scala but it teaches your classic procedural programming. I'm now learning Scala and Scheme after learning Go as I feel that I need to learn more about functional programming

The only problem is that I love functional 😂

Well If you can be contented with closures but no lambdas , explicit type specification in functions, no sum types etc. you will be fine!

If you're interested in some harsher views of Go I recommend this article, particularly when the author cites Rob Pike.

Myself I've used Go to rewrite a few webservices. Now that I have, I'm considering rewriting again back to node.js or python. Go's just doesn't offer enough safety advantages to warrant its opinionated style constraints - which often violate gestalt principles - or its unwieldy syntax.

To me, Go appears to be created to satisfy a political/marketing goal rather than a technical one, namely to (a) draw programmers from java and (b) allow companies to hire less capable (cheaper) developers, by keeping the language very simple/restricted and forcing certain style choices.

This isn't necessarily bad, it has been proven that teams with diverse level of experience perform best. But I personally feel that Go isn't promoting diversity, it's promoting 'simple' work, as there is no way for 'more experienced' programmers to use the tools they want in Go.

However, based on salaries for the adverts I've seen in my country over the last year, learning Go as a career move does appear to make sense.

I don't know if initially Go was created for marketing reasons or not, but the simplicity and the forced style can be a plus in the long run. All code looks the same, the difference is what the code does, not how it is written in the page.

You can still name functions and variable counter intuitevely to make it obscure :D

Like any tool, Go has pros and cons, use it where it shines the most.

Notice: some of these pros/cons in and of themselves are not unique to Go, but the combination with others is what sets Go, as a whole package, apart from other languages.

Pros:

  • Easy to learn. Go has a small learning surface area, thus not as a steep learning curve as other languages.
  • Productive language. Allows you to Get Shit DoneTM with little to no ceremony.
  • Safe language. No manual memory management.
  • Fast language. Micro-benchmarks show that it does not trail far behind C/C++.
  • First-class concurrency primitives. Concurrency is well-designed and built-in, not a library/module.
  • Fast build times.
  • Easy deployments. Compile to your target OS and arch and Just Ship ItTM.
  • Tooling, ecosystem, and libraries around Go are mature, stable, and generally high quality.
  • Because of the above perks, many are predicting it will be the go-to language for cloud-native projects, due to its lower barrier-to-entry and easier scaling efforts across massive distributed systems.

Cons:

  • The Go team resisted including package management in the language around v1.0, claiming that it was a community problem, not a language problem, and the community needed to solve it. Well, this led to at least 15 package management tools with different specs. The Go team has realized the need for this and are actively working on adding official package management support in the next minor version or two. It's in beta in the current version 1.11
  • No generics. Depending on who you talk to, some may agree that it's a negative, others may shrug their shoulders in indifference. I am in the latter camp, but the Go team is also open to some form of generics primitive that fits within the language's design.

There are Go Surveys for 2016 and 2017 that may reveal some additional insights into what the Go community thinks are the pros and cons of the language.

Yes, especially if you care about the engineering problems that Go try to solve in the Cloud.

Also it only has around 15 keywords, extremely simple to learn. While you were reading this article comments you could have learn 40% of Go.

Most haters will pinpoint superficial reasons, but once you understand why Go is this way you will appreciate its simplicity and see that there is no other way to solve them.
Most design decisions will enforce the devs to build a robust, easy to maintain codebase.

Who compares Go to C has no idea what he is talking about, I haven't see any C support for lambda functions, but I saw projects that had 80000LOC of C for a database connection transformed to 20LOC of Go. Most probably you will not see fridges and microwave software written in Go either.

Also based on your previous language experience you will appreciate the builtin tools and the new package management system, which compared to JS nightmare are a bliss.

I like Go.

I'm not using it professionally, though (only using JS at work).

When I started learning it I made a favicon-to-ascii-converter and a service for getting Spotify-Auth-Tokens for a React-App. Both went pretty smoothly and I sticked to it. My latest project is a 2D-game I'm doing with SDL2.

The Pros I see for myself:

  • I usually code in a procedural and compression-oriented style, so I think it fits my boring way of thinking.
  • No exceptions
  • I don't have to think about formatting at all
  • There's bindings for lots of stuff (QT, SDL2..)
  • Quick build-time, at least for my small projects.
  • VSCode and Goland/IntelliJ are great tools
  • Easy to get productive with

The cons:

  • Too strict sometimes. "Use that variable or I won't build". (The great thing about C in contrast is, no matter how dangerous or uncommon something is, you can always "do the thing")
  • Slices are somewhat uncommon IMHO and I'm not sure I understood them completely yet.

Check out Michael Fogleman for lots of great Go-code

Also a great learning resource: usegolang.com/ (Full Web-App with Go)
And what I'm currently doing: interpreterbook.com/ (Writing a basic interpreter in Go)

Thanks for sharing the materials and the great write-up

I'm a scala developer and other colleagues are doing kotlin and java. Unfortunately we have a codebase, from an external company working for us, with 75% Go code, so we have to handle that. Luckily I have not done so much until now, but I can hear my colleagues crying out a least twice a day "What a shit is this?". Maybe the code is bad, structs are copy&pasted, error handling is primitive and the lack a high level programming language features. It's good for a quick hack like importing data.
Maybe you should have a look on Rust. Same performance but a lot better designed.

You made me laugh imagining your colleagues shouting out loud

I think you have no reason not to.

I had Go on my roadmap, but I changed it to Rust after reading experiences and opinions. This is just a comment, of course, I can not talk more on either of them.

Don't.

IMO, Go is a worse version of C, made for people who don't want to go the extra step to achieve the same goal in C. Yep, you won't have pointer problems in Go and there is some fresh hype around it. So what?

I tried it - and I continued to write my software in C. Go has nothing to offer, except a much more restrictive syntax. Nothing that I would want to have..

YMMV.

What about the built-in concurrency support and ecosystem?

Interesting. Can you give some example of Go's restrictive syntax compared to C?

if (something)
{

This won't work in Go.

That won't work in C either:

#include<stdio.h>

typedef enum { false, true } bool;

int main() {
   bool isOk = true;

   if isOk {
       printf("Its ok");
   }
}

So it's subjective at the end of the day.

C allows you to format valid syntax freely. Your example is not valid syntax.

Go is a worse version of C, made for people who don't want to go the extra step to achieve the same goal in C

It isn't and that's a very diengenous comment.

Go is a type-safe (unlike C) general purpose language with a garbage collector which for 99% of problems out there are very useful. For sure if you dont want GC use C or Rust.

There is a GC for C, many projects use it.

Well, that's news to me :)

Is it really any good?

Man all that memory management I did all those years ago was all for naught.

Still Go is a million times easier to write than C and will be easily performant enough for most tasks a developer would want to do.

all that memory management I did all those years ago was all for naught.

It's always good to know what happens in your computer.

Go is a million times easier to write than C

C gives you much more freedom in terms of formatting, it has no "implicit semicolon". Much less annoying in my opinion. (And the multiple return values of Go can be demanding.)

Classic DEV Post from Apr 30

Tech Events this Week - 4/30

Let's crowdsource tech events going on in different areas!

Ido Shamun
Co-Founder The Elegant Monkeys, Co-Maker of Daily Now and a passionate software developer

DEV is a community of software developers

Sign up (for free)