Two gophers reading something

Learning Go

Introduction

This repository contains a series of challenges to learn Go in an incremental way. Each challenge will introduce new concepts such as struct, testing, data persistence, etc. Furthermore, each challenge will be built on top of the previous ones, so it is not recommended to try Challenge #2 without completing Challenge #1.

By the end of this series of challenges, we will have a minimal project that will expose a REST API, persist data in a database and consume some domain events from Kafka in a docker environment.

Disclaimer: This is not intended to teach Go, but to allow us, developers, to have a safe pet project in which we can validate and put into practice our learnings regarding Go and its ecosystem. So look at this repository as a coding dojo 🥷.

To take a look at other resources to learn go, please go to: https://confluence.mpi-internal.com/display/LHP/Backend+onboarding+resources

Challenges

As it was mentioned earlier, here you can find a series of incremental challenges to practice coding with Go and its ecosystem. In the challenges directory you can find a complete list of the challenges and their instructions. At the moment the available challenges are:

Challenge #1. Visibility in Go, structs and data structures

In this challenge we are going to work on how Go handles visibility by creating our first module and packages. Furthermore, we will define our first structs and data structures (arrays, maps and slices).

Challenge #2. Error handling and testing

In this second challenge we are going to practice error handling and adding the first test suites to test the pieces of code which we have been working on until now.

Challenge #3. Building an HTTP API

In this third challenge we are going to create our first HTTP API with Gin and to validate it with some fresh new contract tests.

How to start

To start with this series of challenges, the minimal requirements are:

1. Fork this repository

The way of go with these challenges is by forking this repository and working in your own version of the repository. This way, all of us can have tons of solutions to learn from!

2. Install Go

Follow instructions from https://go.dev/doc/install.

On macOS if you are currently using Homebrew is even easier, just type in your terminal:

brew install go

3. Set up your favourite IDE

Furthermore, JetBrains has its own IDE for Go: GoLand. However, if you are already familiar with IntelliJ, the recommendation should be to continue with IntelliJ.

4. Have fun and share!

Most of the time, there will be different ways of solving a challenge, the purpose of this repository is double: to practice with Go's ecosystem and to set up interesting discussions between us, so we encourage you to share your solutions or your doubts with the community (at slack: #learning-go) to learn from each other ❤️

That's all! You are completely ready to dive into the first challenge 🚀