Author: Dave Cheney

Fatih’s question

A few days ago Fatih posted this question on twitter. I’m going to attempt to give my answer, however to do that I need to apply some simplifications as my previous attempts to answer it involved a lot of phrases like a...

Read More

Mid-stack inlining in Go

In the previous post I discussed how leaf inlining allows the Go compiler to reduce the overhead of function calls and extend optimisation opportunities across function boundaries. In this post I’ll discuss the limits of...

Read More

Inlining optimisations in Go

This is a post about how the Go compiler implements inlining and how this optimisation affects your Go code. n.b This article focuses on gc the de facto Go compiler from The concepts discussed apply broadly to other...

Read More

go test -v streaming output

The testing package is one of my favourite packages in the Go standard library, not just because of its low noise approach to unit testing, but, over the lifetime of Go, it has received a steady stream of quality of life...

Read More

Go compiler intrinsics

Go allows authors to write functions in assembly if required. This is called a stub or forward declaration. package asm // Add returns the sum of a and b. func Add(a int64, b int64) int64 Here we’re declaring Add, a...

Read More

Clear is better than clever

This article is based on my GopherCon Singapore 2019 presentation. In the presentation I referenced material from my post on declaring variables and my GolangUK 2017 presentation on SOLID design. For brevity those parts of the...

Read More

Prefer table driven tests

I’m a big fan of testing, specifically unit testing and TDD (done correctly, of course). A practice that has grown around Go projects is the idea of a table driven test. This post explores the how and why of writing a...

Read More
  • 1
  • 2


Follow Us on Twitter