Ask HN: What is the best way to learn Go?

11 points by W-Stool 3 days ago

After 40+ years of writing C I'm going to learn Go. Is "The Go Programming Language" still the way? It is 8 years old now and the language has seen more than a few changes between then and now. What books should I be looking at?

runjake a day ago

Here's how I did it as someone previously competent in C, C#, Java, etc.

I started here: https://go.dev/learn/

1. Did the Go Tour: https://go.dev/tour/welcome/1

2. Then Getting Started: https://go.dev/doc/tutorial/getting-started

Then, I started a non-trivial project using the excellent Go docs and LearnXinYMinutes as references. https://learnxinyminutes.com/docs/go/

Once I kind of got the hang of Go, I started using Go by Example much more. I've never read a Go book.

With competent prompting, Claude.ai seems pretty good at generating Go code and explaining Go code and this has really accelerated it for me.

All together, I started from not knowing Go to beginning on a non-trivial program in my first 4 hours. It was super great.

cpach 3 days ago

There’s no Go book that I personally would recommend without hesitation.

Instead, I would suggest that you try to find a bunch of blog posts and lectures and read/watch them in order to get a feeling of the Go philosophy. The official Go blog has some good articles and otherwise I recommend to have a look at what Rob Pike and Russ Cox has written/presented.

Then I believe that as soon as possible it’s a good idea to start some toy project so that you can dive in.

I’m afraid I don’t have too many links to share. This might be a good starting point: https://www.youtube.com/watch?v=7VcArS4Wpqk

Here’s a meta-resource that could be useful: https://github.com/avelino/awesome-go (see the Resources section at the end of the ToC).

Best of luck!

h4ck_th3_pl4n3t 2 days ago

https://quii.gitbook.io/learn-go-with-tests

Learn go with tests shows you the "go way" to do it, and introduces you to its integrated testing system while also teaching you go's language concepts.

I highly recommend it, it's awesome and was definitely worth doing it even whennyou are an experienced go programmer already.

The key to benefit from go's toolchain the most is to set your opinions aside. Once you do that, the toolchain will automate so many things for you that you will learn to like only a couple weeks later because it takes time for the conventions to sink in...

  • kandros 2 days ago

    I have a very good memory on this

daviddever23box 3 days ago

If you haven't used a more current programming language in terms of tooling, you may be in for a shock: package management, concurrency, formatting and linting are all sorted, with decent support in Visual Studio Code. I'd honestly look at these things first so that you can right-size individual modules, etc.

gaws 2 days ago

> After 40+ years of writing C I'm going to learn Go.

Why make the switch now?

  • erik_seaberg 2 days ago

    Any garbage collected language avoids a lot of disastrous undefined behavior.

inquisitor27552 3 days ago

40 yrs jeez.

question sir, why not rust or typescript or python? what makes you want golang?

  • uaas 3 days ago

    One can only learn these languages after 40 years, or what is your actual point?

    • inquisitor27552 2 days ago

      guy has 40 yrs experience

      in his 40yr career im asking what makes him want golang over rust ts and python, maybe he sees something that my 10yo xp ass dont which can make me want to try golang

      the downvotes are funny, are people here really anal about their age lol