Skip to content

Instantly share code, notes, and snippets.

@include
Forked from flowchartsman/start.md
Created July 20, 2019 11:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save include/e976025304cb16fc8c71680cdb2c286f to your computer and use it in GitHub Desktop.
Save include/e976025304cb16fc8c71680cdb2c286f to your computer and use it in GitHub Desktop.
Go Learning Resources For the Beginner

Reading

  1. Go through the tour at https://tour.golang.org/welcome/1
  2. Promptly abandon all of those plans you have to use channels everywhere
  3. Read the language spec once over: https://golang.org/ref/spec
  4. https://dave.cheney.net/2017/04/26/understand-go-pointers-in-less-than-800-words-or-your-money-back
  5. Read Effective Go: https://golang.org/doc/effective_go.html
  6. Read CodeReviewComments (essentially a semi-official style guide) https://github.com/golang/go/wiki/CodeReviewComments
  7. http://devs.cloudimmunity.com/gotchas-and-common-mistakes-in-go-golang/
  8. https://coder.today/tech/2018-11-10_profiling-your-golang-app-in-3-steps/ This is a very effective tool in your toolbelt, and you will use it A LOT.
  9. And a smattering of other good articles:

Software

  • IDES
    • I generally use vim & vim-go
    • vscode is excellent as well. It is only a few (but serious) problems in the vim bindings that keep me with Vim...for now.
    • goland is also very good. The JetBrains folks are very good. I don't like the license model, but I understand the need to make a buck, and it does a lot of really impressive things that the others don't, esp with regard to refactoring.
  • Other
    • Dash for OSX is great for local doc searching

Testing

Testing is a first-level concept in Go, and is very important. I recommend reading up on table driven tests, and subtests/benchmarks. These combine well.

Stick to the stdlib testing package for your first couple projects. You can branch out to test frameworks later, but I would encourage you to identify a deep need before doing so. I have yet to find a truly compelling case for other testing frameworks. Perhaps matching libraries. Maybe.

When testing services, you will find yourself having a much easier time if you use dependency injection through interfaces, and for this, nothing beats a good mocking framework. I typically use gomock, but there are others.

Advice

It helps to learn the standard library well, especially strings os and regexp.

You will eventually find yourself writing your own sort of scripty helper libraries like https://github.com/bitfield/script for quick one offs.

If you want to stay current, I recommend installing Go from source, and I've written a guide to do that here. Please let me know if you find any problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment