Hello fellow Go newbies! That’s right, I’ve decided to add yet another Go tutorial to the Internet. I’ve been attempting to learn Go for a while now, and found that existing tutorials are either esoteric deep-dives into Go’s advanced features, or pedestrian walkthroughs of every single statement in the language, in order. I needed a tutorial that would actually teach me to do something useful, so I decided to write one.
In this series of posts we will create a basic web application that will provide a front-end for a public API. Why? Talking to APIs and providing HTTP services are fundamental parts of building microservices. They’re also quite common coding challenges that come up in job interviews :-)
In honour of Star Trek Picard launching this month, we’re going to create a Star Trek themed search engine that looks up dialog from Star Trek: The Next Generation (huge thanks to this dataset). Wait, should I have called this series “Make it Go?”
One of these is a real deep cut reference
Again, to clarify, this is not a complete guide to Go. Rather it’s a tutorial to get you to actually build something, and get a feel for the language along the way. Once you complete this tutorial I’d expect you to go onto one of the more in depth or advanced guides out there on the web. This is also not a complete beginners guide, I’m assuming you have some experience with programming and are familiar with basic types, flow control etc.
To follow along, make sure you have Go installed and an editor/IDE set up and ready to, erm, go. There’s some instructions here that may help. In each stage I’ll go through every line of code we need to write and explain what it’s doing, then I’ll post the entire file in a gist at the end of the post so you can check your code for mistakes.
Let’s get started!