The ‘fat service’ pattern for Go web applications

In this post I'd like to talk about one of my favorite architectural patterns for building web applications and APIs in Go. It's kind of a mix between the service object and fat model patterns — so I mentally refer to it as the 'fat service' pattern, but it might have a mo...

The pervasive effects of C's malloc() and free() on C APIs

Error handling with Go tooling

Most tutorials on Go tooling (and probably most other tooling) tend to focus on the happy path - the input code is perfectly valid and contains no errors. This is often a reasonable assumption, because we tend to run tools on existing code bases, and these are likely to compile c...

Releasing a Go library for content-type negotiation

As I've written about in the past, I'm a big fan of using Server-Driven Content Negotiation for APIs for versioning, but also find it handy for being able to serve different representations of data depending on what the client supports. This is handy to be able to serve an HTML p...

Tools I use to build my website

How I build my website benhoyt.com with GitHub Pages, Jekyll, a simple HTML+CSS layout, Sublime Text, and Sublime Merge.

Snake game in Go using Ebiten

Ebiten is an open source game library in Go for building 2D games that can be ran across multiple platforms. Ebiten games work on desktop, web browsers (through WebAssembly), as well as on Mobile and even on Nintendo Switch.

Using generics to get a pointer to any type, in Go

In Go, we use pointers to define that a value may be optional. Often, we'll use the & operator to provide the pointer value to a method, so we can do something like this: method(&api.Response{}) The issue is that not every type can use the & operator, for instance we...

Print based debugging and infrequent developers

Optional configuration for configuring Go code

When you're writing a reusable piece of code in a library, you often want to allow your code to be extensible to a point, in a way that allows safely modify behaviour without exposing too many of the internal workings. A pattern that seems to be working really well in Go is by pr...

spf13 Google -->

I’m leaving my role as the Product Lead for the Go Language at Google. I’m super proud of everything the Go team has accomplished in the last six years, and I’ve never been more excited for Go’s future. Read on if you’re interested in what led me to my decis...