iota is a neat feature of Go that lets us create “enums”: lists of constants with arbitrary values. Let’s find out how to use iota, with this quick tutorial.
All tagged golang
iota is a neat feature of Go that lets us create “enums”: lists of constants with arbitrary values. Let’s find out how to use iota, with this quick tutorial.
There’s an easy, pleasant, and reliable way to build software in Go, guided by tests. Let’s find out what it’s like to program with confidence, in the first part of this TDD tutorial series.
Generics what now? This friendly, down-to-earth tutorial series explains how Go’s generic functions and types work, why we need them, and where we can use them.
The iterator proposal is a neat way to write “lazy loops”, where we never generate more results than we actually use. Let’s see what that would look like in Go programs.
Which is a better choice, Rust or Go? Which language should you choose for your next project, and why? How do the two compare in areas like performance, simplicity, safety, features, scale, and concurrency?
In the thrilling conclusion to our fuzz testing series, we’ll use Go’s fuzzer to find a real bug in our code, and also to verify the fix.
Let’s continue our exploration of fuzz testing in Go with a look at how to write a fuzz target for a (nearly) realistic function. This time we’ll try to detect a common kind of bug involving a confusion between runes and bytes.
Fuzz testing is Go’s clever way of generating new test inputs that you didn’t think of—and that may flush out some hidden bugs. Stand by for things to get a little fuzzy!
What is the Tao of Go, and how can we work with it, like a surfer going with the waves instead of struggling against them? By being kind, simple, humble, and not striving; here’s how.
Choosing good test cases for our Go programs can be a bit hit-and-miss. What if we could automate that process? Let’s talk about randomisation, property-based testing, and Go’s built-in fuzz testing feature.
How do you test a database without a database? Don't worry, this isn't one of those Zen puzzles. I have something more practical, but equally enlightening, in mind. Let’s use the adapter pattern to solve the riddle.
To celebrate the first anniversary of generics in Go, let’s build something practical and useful: a generic Set type, and add some neat methods to it. Ready for fun?
In Part 2 of a series about writing packages, not programs, we see how to test a package that prints to the terminal, and use the result to build our “hello, world” CLI tool.
Go has a great standard library. What if we think about our work not merely as building one-off programs, but instead contributing packages to the universal Go library?
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.
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.
Continuing our series on the testscript package, we look at some advanced techniques in test scripts such as conditions, concurrency, and managing environment variables.
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.
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.