Are you and your team new to Go? Could you use some expert advice? Check out my Comprehensive Go Code Audit service!

Buggy BLANK identifiers in Go
I recently found a bug in golangci-lint... and even in Go 1.18, related to blank identifiers! What are they? Are they ever useful?
Go Code Roast #2: readability.js port
In this video, I roast a port of a Mozilla Javascript library, readability.js to Go.
Go Code Roast
In this video, I roast some Go code! That is, I review it as if it were submitted as part of a job application screening. I talk about what I like, what I don't like, and how I would do things differently.

Go JSON Tricks: The Self-Referencing Marshaler
For more content like this, buy my in-progress eBook, Data Serialization in Go, and get updates immediately as they are added! The content in this post is included in my in-progress eBook, Data Serialization in Go, available on LeanPub. I’ve done a lot of JSON handling in Go. In the process, I’ve learned a number of tricks to solve specific problems. But one pattern in particular I find myself repeating ad infinitum.

Go JSON Tricks: Extending an Embedded Marshaler
This post is an excerpt from my in-progress book, Data Serialization in Go, available on LeanPub. Back in 2016, when I was still fairly new to Go, I asked a question on StackOverflow about how to properly marshal a struct which embeds a struct with a custom MarshalJSON method. I got a few answers that helped point me in the right direction, but to this day I never received a completely satisfactory answer, that allows extending the existing MarshalJSON method, without duplicating it.

How to Use Nancy to Improve Your Go Application Security
Nancy, as you may know by reputation, is a detective. She uses Sonatype's OSS Index to check for vulnerabilities in your Go dependencies.
Subscribe to the Daily Commit
Every day I write about improving software delivery at small companies like yours. Don't miss out! I will respect your inbox, and honor my privacy policy.Unsure? Browse the archive.

Go JSON Tricks: JSON Arrays as Go Structs
For more content like this, buy my in-progress eBook, Data Serialization in Go, and get updates immediately as they are added! The content in this post is included in my in-progress eBook, Data Serialization in Go, available on LeanPub. Most JSON you find in the wild uses objects when different types of data are required. A contrived, but believable example: { "status": 404, "result": "error", "reason": "Not found" } But sometimes you’ll find this exact same data expressed in a different way.

Go JSON Tricks: "Slightly" Custom Marshaling
For more content like this, buy my in-progress eBook, Data Serialization in Go, and get updates immediately as they are added! Have you ever found yourself writing a custom JSON marshaler in Go, because you needed something only slightly different than what the standard JSON marshaler provides? Maybe the consumer of your JSON payload expects an array where you have a single item. Or maybe you need to nest your object one level deeper in your JSON than is used in your application.

Simple Go Mocks
Go’s interfaces and “duck typing” makes it very easy to create simple mock or stub implementations of a dependency for testing. This has not dissuaded a number of people from writing generalized mocking libraries such as gomock and testify/mock, among others. Here I want to describe a simple alternative pattern I frequently use when writing tests for an interface, that I think is generally applicable to many use cases. No Silver Bullet Of course neither this approach, nor any other, is a one-size-fits-all solution.

How I got go-spew to work with GopherJS
go-spew is a very handy library used for dumping arbitrarily complex data structures in a (roughly) human-readable format. This is immensely helpful when debugging or writing automated tests in programs. Coupled with a package like go-difflib, it can make comparing the expected and actual results of a test not only easy, but into something approaching fun. Much of my time lately is spent hacking on projects to be compiled by GopherJS, the Go-to-JavaScript compiler.