Learn Go with tests
Contribute on github
main
main
  • Learn Go with Tests
  • Go fundamentals
    • Install Go
    • Hello, World
    • Integers
    • Iteration
    • Arrays and slices
    • Structs, methods & interfaces
    • Pointers & errors
    • Maps
    • Dependency Injection
    • Mocking
    • Concurrency
    • Select
    • Reflection
    • Sync
    • Context
    • Intro to property based tests
    • Maths
    • Reading files
    • Templating
    • Generics
    • Revisiting arrays and slices with generics
  • Testing fundamentals
    • Introduction to acceptance tests
    • Scaling acceptance tests
    • Working without mocks
    • Refactoring Checklist
  • Build an application
    • Intro
    • HTTP server
    • JSON, routing and embedding
    • IO and sorting
    • Command line & package structure
    • Time
    • WebSockets
  • Questions and answers
    • OS Exec
    • Error types
    • Context-aware Reader
    • Revisiting HTTP Handlers
  • Meta
    • Why unit tests and how to make them work for you
    • Anti-patterns
    • Contributing
    • Chapter Template
Powered by GitBook
On this page
  • Support me
  • Learn test-driven development with Go
  • Background
  • What didn't work
  • What did work
  • What works for me
  • Who this is for
  • What you'll need
  • Feedback

Learn Go with Tests

NextInstall Go

Last updated 1 year ago

Support me

I am proud to offer this resource for free, but if you wish to give some appreciation

Learn test-driven development with Go

  • Explore the Go language by writing tests

  • Get a grounding with TDD. Go is a good language for learning TDD because it is a simple language to learn and testing is built-in

  • Be confident that you'll be able to start writing robust, well-tested systems in Go

Translations:

Background

I have some experience introducing Go to development teams and have tried different approaches as to how to grow a team from some people curious about Go into highly effective writers of Go systems.

What didn't work

Read the book

I love this book but it requires a high level of commitment. The book is very detailed in explaining concepts, which is obviously great but it means that the progress is slow and steady - this is not for everyone.

I found that whilst a small number of people would read chapter X and do the exercises, many people didn't.

Solve some problems

Katas are fun but they are usually limited in their scope for learning a language; you're unlikely to use goroutines to solve a kata.

Another problem is when you have varying levels of enthusiasm. Some people just learn way more of the language than others and when demonstrating what they have done end up confusing people with features the others are not familiar with.

This ends up making the learning feel quite unstructured and ad hoc.

What did work

Over time the team gained a solid foundation of the grammar of the language so we could then start to build systems.

This to me seems analogous to practicing scales when trying to learn guitar.

It doesn't matter how artistic you think you are, you are unlikely to write good music without understanding the fundamentals and practicing the mechanics.

What works for me

When I learn a new programming language I usually start by messing around in a REPL but eventually, I need more structure.

What I like to do is explore concepts and then solidify the ideas with tests. Tests verify the code I write is correct and documents the feature I have learned.

Taking my experience of learning with a group and my own personal way I am going to try and create something that hopefully proves useful to other teams. Learning the fundamentals by writing small tests so that you can then take your existing software design skills and ship some great systems.

Who this is for

  • People who are interested in picking up Go

  • People who already know some Go, but want to explore testing more

What you'll need

  • A computer!

  • A text editor

  • Some experience with programming. Understanding of concepts like if, variables, functions etc.

  • Comfortable using the terminal

Feedback

An approach we tried was to take and every week discuss the next chapter along with the exercises.

By far the most effective way was by slowly introducing the fundamentals of the language by reading through , exploring them with examples and discussing them as a group. This was a more interactive approach than "read chapter x for homework".

Add issues/submit PRs or

Tweet me @quii
Mastodon
Buy me a coffee
Sponsor me on GitHub
中文
Português
日本語
한국어
Türkçe
the blue book
go by example
Installed Go
here
tweet me @quii
MIT license
Art by Denise