You want to learn a new programming language? You aren't sure about what language to choose? Have you heard about Go? Well, let's Go!
"Go is an open source programming language that makes it easy to build simple, reliable, and efficient software". golang.org
Go is a popular language these days. According to Stack Overflow 2020 Developer Survey, Go is in the top 5 of most loved languages. It ranks in the top 3 most wanted languages. Docker, Kubernetes, and a growing list of projects use Go.
Motivation
Go reduces the complexity of writing concurrent software. Go uses the concept of channels and goroutines. These two constructs allow you to have a "queue" and "two threads" to write to and read from it, out of the box. Rob Pike, one of the creators of Go, explains these concepts in his talk Concurrency is not parallelism. In other languages, you would need error-prone code to achieve similar results. Threads, locks, semaphores, etc, ...
Method
Learn something by doing. This is one of the takeaways from the book Pragmatic Thinking and Learning. Instead of watching videos or skimming books, recreate examples and build mini-projects. "Instead of dissecting a frog, build one".
No Copy/Paste. Read the sample, "cover" it and reproduce it without looking at it. If you get stuck, search online instead of going back to the sample. For exercises, read the instructions and try to solve them by yourself. Then, check your solution. Fire up your text editor!
Resources
Before starting, you can have a general overview of the language with Pluralsight course Go Big Picture. To grasp the main concepts, you can follow Learn Go with tests. It teaches Go using the concept of Test-Driven Development (TDD). Red, green, refactor. Other helpful resources to are Go by Example and Go documentation.
“To me, legacy code is simply code without tests.”
― Michael C. Feathers, Working Effectively with Legacy Code
Basic
- Guess the number, simple calculator
- Build some CLI tools like cowsay, lolcat and fortune
- Build your own shell
- Caesar cipher
Intermediate
- Fun weekend projects like an Slack bot (a Twitter bot if you prefer Twitter) or a simple key-value store. You can find another take of a Slack bot here
- Write a data structure like a linked list, a stack or a queue
- Build a CLI wrapper for XKCD
- Build and test a REST API with PostgreSQL or Build a REST API with Fiber and SQLite
- Build an API client
- The Super Tiny Compiler
- If you're coming from Node.js API for Node.js developers
Advanced
- Write cleaner web servers
- Create an FTP Client. You need to understand sockets
- Write a SQL database
- Let's Create a Simple Load Balancer With Go
- Building a BitTorrent client from the ground up in Go
- Building a Web Server
Fullstack
- Chat with Angular or React
- Url shortener with Redis or CouchDB. Another take with Redis and Iris
- Todo with MongoDB and React
- Blog App Tutorial
- Building a Microservice
You can find more project ideas here: 40 project ideas for software engineers, What to code, Build your onw x and Project-based learning.
Conferences
- Concurrency is not parallelism
- How do you structure your Go apps
- Things in Go I Never Use
- Best Practices for Industrial Programming
- 7 common mistakes in Go and when to avoid them
Conclusions
Go was design to reduce the clutter and complexity of other languages. Go syntax is like C. Go is like C on asteroids. Goodbye, C pointers! Go doesn't include expected features like inheritance, exceptions or generics. Yes, Go doesn't have exceptions. But, Go is batteries-included. You have included, for free, a testing and benchmarking library, a formatter and a race-condition detector. Coming from C#, you can still miss assertions like the ones from NUnit or XUnit. Aren't you curious about a language without exceptions? Happy Go time!
You can find my own 30-day journey following the resources from this post in LetsGo