Articles on Go

Last updated: 2022/09/05

Top deep-dives on Go

Go (golang) Error Handling - A Different Philosophy

One of the things I love about finding and exploring new programming languages is coming across a novel design philosophy. It usually ends up as inspiration for some design choice in a different language I'm using. Jeremy Clark's article takes a look at the error handling philosophy for Go and compares it to C#. Jeremy also does a good job of highlighting the conventions as he goes.

Build Your Own Container Using Less than 100 Lines of Go

Although this article is from 2016, containers are more relevant than ever. Most cloud providers offer containerized systems that are deployable at the click of a button, and running processes in clean environments on a dev machine has never been easier. In this article, Julian Friedman implements a container in Golang and describes what every line of code does.

Go linknames

Every once in a while you stumble upon a neat feature in a language. Sometimes it's practical, other times it's not (until it is), but it's always satisfying knowing some obscure feature that could end up saving you a bunch of time someday. In this concise article, Paschalis Tsilias present Go linknames, and "one of their uses in the Go tree is to allow flexibility while maintaining the compatibility promise". Paschalis also includes an example in Go to demonstrate their use.

Scalability and Load Testing for VALORANT

I used to play a lot of LoL, and one of the common memes among players was Riot's spaghetti code causing all sorts of bugs and glitches. Fortunately Keith Gunning inspires some faith in their development team with this extensive article on recent developments for Riot's new game. Keith covers the whole infrastructure and testing process.

Go'ing Insane Part One: Endless Error Handling

Sometimes I feel like Go is trying to be sold to me like the fix all solution for any backend application. Why use X, Y, or Z when you can just use Go? Well it's not all ladi-da in Go land, as Jesse Duffield highlights in the article. Jesse covers issues with error handling, order dependence, trailing returns, loops, zrero values, and named returns.

Faster software through register based calling

In Go 1.17, "function arguments and return values will now be passed using registers instead of the stack". What effect will this have on performance? Well that's exactly what Menno Finlay-Smits covers in this article, in addition to a refresher on how the stack works and differences in 1.16 and 1.17 compiler outputs.

Sorting a Dependency Graph in Go

You know what gets more flak than frontend engineers? "Implement algorithm X" in coding interviews. Well... although most of those questions aren't very good measures of how good a fit the candidate will be (in most cases), algorithms are nonetheless important to software engineering. In this article, Andrew Meredith implements one such algorithm in Go in order to build and sort a dependency graph.

Saving a Third of Our Memory by Re-ordering Go Struct Fields

With modern computers having a comfortable to insane amount of RAM available, it's pretty easy to be lazy with our memory management as programmers. In this article, Lane Wagner explains how a minor change in how a struct was defined had a major impact on a program's memory consumption.

Hey linker, can you spare a meg?

The problems you face in the real world with practical applications rarely have an absolutely correct answer. Usually you're going to have to pick whatever meets a set of criteria inherent to the situation. Josh Bleecher Snyder's article discusses how his team altered the Go linker to get the memory footprint of their iOS application down from 13 MB to 7 MB (only to have iOS 15 ruin it again).

Crimes with Go Generics

Xe Iaso presents a Go package they've written that dives deeply into several examples of how to not use Go generics. Again, how to NOT use them.

SkipList in Go

Ke Pi implements the skip list data structure in Go.

Internals of Go's new fuzzing system

Jay Conrod delves into what is fuzzing, its presence in Go, how it works, and its future.

Rewriting Go source code with AST tooling

What language do you know that providers great tools for analyzing itself in the core package? If Go wasn't the first thing you thought of, then let me know what was. In this article, Eli Bendersky introduces the go/ast package and uses it to do some basic rewrites, outlines the limitations of such methods, and proposes a better alternative.

A flexible, lightweight, spin-lock barrier

Chris Wellons explains how he developed the titular feature while trying out a memory reordering experiment in C11 and Go.

Dumpster diving the Go garbage collector

Natalie Serrino traces the Go garbage collector's low-level behavior on a live application using eBPF uprobes.

How Go Mitigates Supply Chain Attacks

Filippo Valsorda explains the different approaches Golang uses to mitigate security issues derived from using code you haven't written.

A faster lexer in Go

Eli Bendersky explores "some potential optimizations to a lexical scanner written in Go", focusing on "the relative efficiency of converting byte slices to strings vs. taking substrings", "some strategies w.r.t. API design in Go", and "optimizing GC behavior".

A comprehensive guide to go generate

Writing macros is a double edged sword; on one side writing code that writes code is the epitomy of l33t h4x0r, while on the other side the chances of you blowing off your foot with a 12 gauge equivalent of spaghetti code are fairly high (whoa what an image). Well in any case, if you plan on mutilating yourself, you might as well do it in an educated manner. In this informative article, Eli Bendersky explores "go generate", Golang's system for macros. Eli starts off with a brief introduction, followed by a deep-dive into the stringer generator and advanced features.

Interface method calls with the Go register ABI

Eli Bendersky "takes a deeper look into how Go compiles method invocations; specifically, how it compiles interface method invocations".

Parent links in Go ASTs

Eli Bendersky flips through a number of different approaches to finding the parent of a node in an AST in Go. Other highlights: <ul> <li>AST nodes in Go do not have parent links, which can make it difficult to find a node's parent, or more generally, all the ancestors of a given node</li> <li>There are a few different ways to find a node's parent in an AST: the ad-hoc approach, keeping manual track of parents, using Inspector.WithStack, or with PathEnclosingInterval</li> <li>The ad-hoc approach is the simplest, but it is not very reusable</li> <li>Keeping manual track of parents is more work, but it is more reusable</li> <li>Using Inspector.WithStack is the most work, but it is the most reusable</li> <li>With PathEnclosingInterval is the least work, but it is the least reusable</li> </ul>

Abuse Of Some Sum Types In OO Languages

Jeremy Bowers explains why not everything is actually a nail when you learn how to wield the hammer that is sum types.


Want to see more in-depth content?

subscribe to my newsletter!

Other Articles