I think and write about software and algorithms. I also like to talk about books sometimes. If this is your first time here, maybe you would like to dive straight in and read about an algorithm to solve regex crosswords. Or if you like books, check out my controversial-on-hacker-news post 3 Rules for Choosing Nonfiction Books.

When not writing this blog I work as senior software engineer at Skyscanner in London. You may also know about the open source project I co-founded, Go Report Card. Currently I am writing a book called Production Go.

3 Rules for Choosing Nonfiction Books

I love reading nonfiction. But, as I am sure you can relate, I only have limited time. Even if we were able to make enough time to read one book a week on average—certainly not the case for me right now—we would still only be able to read around 3,000 books in our entire adult lives. At my current pace, the real number will likely end up being far lower. [Read More]

Efficient Bit Manipulation in Go 1.9

Go 1.9, released in August 2017, introduced the maths/bits package. This package provides optimized functions for bit counting and manipulation of unsigned integers. These are useful in low-level environments where the individual bits stored in an integer are of importance. Let’s take a look at some of the functions. First up, Len returns the minimum number of bits required to represent a value x. package main import ( "fmt" "math/bits" ) func main() { var a uint = 31 fmt. [Read More]

Diary of Building an iOS App with React Native

When news broke that React Native was open sourced on Friday, I felt elated. This was the moment I had been waiting for. Ever since the React.js conference videos introduced React Native in late January, I couldn’t wait to get my hands on it. If you don’t know React Native, it’s a new open source framework by Facebook that allows you to write iOS (and, eventually, Android) apps using HTML-like code (called JSX) and JavaScript. [Read More]

Excellent Open Source Go Projects

Something I often hear new Go developers say is that they are looking for some good projects to study, learn from and contribute to. Normally I suggest reading the Go source: it’s easy to read, you can pick a part you are interested in, and is probably bound to be the best example of idiomatic Go. But this past weekend presented itself with an opportunity to find more open source Go projects that are of the highest quality. [Read More]

Solving Regex Crosswords using Go

I first discovered regular expression crosswords two weeks ago, when RegexCrossword.com appeared on the Hacker News front page. I thoroughly enjoyed the nerdy 30 minutes I spent doing the puzzles, but soon enough my natural inclination towards making computers do my hard work got the better of me: I wanted to solve this with code. This morning I had some free time and decided to give it a shot. [Read More]

Running the Go Race Detector with -cover

There are two test options that make testing in Go especially powerful: one is -cover, which generates test coverage reports, and the other is -race, which warns of possible race conditions in your code. If you haven’t used them yet, you should. They are very useful tools, and both are covered well (so to speak) by official blog posts: The cover story and Introducing the Race Detector. A subtle problem arises, however, when you use these two together. [Read More]

Efficient String Concatenation in Go

In this article I investigate the computational performance of various string concatenation methods in the Go programming language. To evaluate the options, I prepared some typical Go benchmarks using the Go testing package. A benchmark looks something like this: func BenchmarkBufferString(b *testing.B, numConcat int) { var ns string for i := 0; i < b.N; i++ { next := nextString() buffer := bytes.NewBufferString("") for u := 0; u < numConcat; u++ { buffer. [Read More]

Why is Golang popular in China?

Earlier this week I wrote a post titled The Popularity of Go. The post itself turned out to be quite popular, and I received a lot of great feedback from the Go community (thanks!). One thing I brought up in the post, and that a lot of folks commented on, was the apparent popularity of Go in China according to Google Trends. The graph above shows the searches for “golang” by country on Google Trends. [Read More]

The Popularity of Go

When you look at the Google Trends graph above, it would seem like the Go programming language, also known as Golang, is on its way to big things. But let’s not get ahead of ourselves, Go fans. Let’s first have a cup of java to put things into perspective: Golang’s popularity as a search term might be growing faster than bamboo in springtime, but it’s still dwarfed by the massive overgrowth that is the Java programming language. [Read More]