Did you know that Go lets us provide executable code examples as part of our documentation? It’s pretty neat. Let’s take a tour of this useful feature and see how it works.
Did you know that Go lets us provide executable code examples as part of our documentation? It’s pretty neat. Let’s take a tour of this useful feature and see how it works.
Distinguishing between specific error values and types is easy in Go, thanks to the (relatively) new errors.Is and errors.As functions. Let’s talk about what they do, when and how to use them, and how to know which one is appropriate.
Wouldn't it be nice if we could run test scripts directly from the command line? The standalone testscript tool does exactly that. Let’s see how to use it to create simple, self-contained issue repros.
Usually what matters about an error is that it’s not nil, but what if we want to know whether it’s some specific error value? For example, in a test? Let’s look at some of the right and wrong ways to do that.
Continuing our series on the testscript package, we look at some advanced techniques in test scripts such as conditions, concurrency, and managing environment variables.
How should we test errors in Go? And how does the need for this testing influence the way we construct, handle, and pass around errors within our Golang programs?
The txtar format is an ingenious way to supply arbitrary files and folder structures to test scripts. We’ll also learn about file management, simulating standard input, and breaking up scripts into phases.
The testscript package gives us an easy way to test the behaviour of a Go CLI tool, by executing it as an independent binary. Let’s see how.
If you’re a BIT student, are you ready for your green belt test? If you’re studying independently, check your Go skills and see whether you’d pass this demanding certification.
Wouldn’t it be great if we could write tests for our Go CLI tools that are simple as shell scripts? The testscript package lets us do exactly that. Let’s take it for a spin.
Visual Studio Code is the most popular Go editor, and no wonder: it’s the Batman’s utility belt of editors. Let’s cape up and take a tour of VS Code’s Go superpowers.
Being a Time Lord isn't about which planet you're born on, or whether you can regenerate. You don't even need a sonic screwdriver. All you need to do is think effectively, and do the right things, in the right way, at the right time. Here’s how.
The internet is very big, and a vast ocean of network resources lies undiscovered before us. Let's dip a hook into that ocean now and see what we can catch with an API client in Go.
The Unix shell is pure wizardry. Why shouldn’t it be as easy to write systems programs in Go as it is in the shell? The script library is the secret spell-book that makes this possible.
“Clean code” is so over: all the cool kids are switching to CRISP code. I’ll show you how to achieve it in five catchy, T-shirt-friendly slogans.
The new io/fs package in Go 1.16+ gives us a powerful new way of working with filesystems. Walk with me, then, as we take a tour of the new fs.FS interface and see what it can do.
Alex Edwards’s new book Let’s Go Further is both an essential reference for Go developers and a valuable compendium of battle-tested knowledge about using Go in practice. Read my review to learn more.
The defer keyword in Go can seem mysterious at first: why do we need it? How do we use it? Let’s explore some common patterns that use defer to build robust, efficient programs by preventing resource leaks.
Pointers in Go sound scary, but they’re actually very straightforward. Let’s find out what they are, why we need them, and what to watch out for.
What is test-driven development (TDD), and how does it work in Go? This friendly tutorial shows you how to build a new Go package from scratch, test-first, step by step. All you need is Go!