One-lining errors.As with generics

November 25, 2022

I’m sure someone out there has already thought of this. But I stumbled on it when looking at errors.As statements in a contribution I was making to Flipt. UPDATE: I found an existing proposal to add this to the standard library and in there it appears this was called out in the generic design proposal itself: TL;DR This function is handy for brevity and to avoid a potential runtime panic: ... Read more

Hidden Options for Testing

January 7, 2020

I am uncertain this is a good idea, but I am experimenting with it. Before I get into the crux of this post, you should become familiar with a couple useful concepts in Go: Functional options. Using an external test package. Mocking time.Now in tests. The following is a quick recap on all three. Functional Options The first time I learnt about them was through Functional Options For Friendly APIs by Dave Cheney. ... Read more


April 30, 2019

I recently edited my first wikipedia entry. I was learning about how Google indexes websites with BigQuery and stumbled across the page for reverse domain name notation. It makes sense when creating and index of URLs to do so in reverse domain order. This is the process of flipping the constituent parts of a URL like so: becomes and becomes and so on. I was delighted to see all examples of reversing a list in different programming languages. ... Read more

Defensive Concurrency in Go

January 21, 2018

Before I get to deep in to the weeds of this post. I want to set some expectations. This is not an explanation of how to solve a well understood problem with a textbook solution. Nor is it necessarily the ideal solution to the problem itself. This solution is the product of avoiding scope creep and minimizing the surface area of a refactor. UPDATE: I found this very implementation in the http://gopl. ... Read more

Getting Started With BuildKit

January 2, 2018

The clever peepz over at Moby are clearly hard at work revolutionising the way we work with containers and images. I have recently been interested in the BuildKit project. BuildKit is a toolkit for converting source code to build artifacts in an efficient, expressive and repeatable manner. buildkit What is BuildKit? In a nutshell BuildKit is an engine which interprets a graph of instructions into a target container image format. ... Read more

© 2018 | Follow on Twitter | Hucore theme & Hugo