I was writing some stuff that programmatically executed terraform via Hashicorp's terraform-exec library this week. This works by interacting with a terraform executable that you provide (along with a working directory) to the NewTerraform constructor. Here's the trick: when testing this code it does not need to interact with the real executable. It can subprocess… Continue reading How to Test Code that Executes Subprocesses
Map and Filter with Generics and Go 1.23 Iterators
I found myself missing map and filter constructs for some small things in Go, and here we are. Go 1.18 got generics, and I've admittedly not used them too much in real apps. Go 1.23 brought iterators. The combo of these two makes map/filter pretty easy to create. They play nicely with the utilities in… Continue reading Map and Filter with Generics and Go 1.23 Iterators
How to Debug OAuth Auth Code Login Flows
This is from the oauth clients perspective. Some piece of software is implementing a login with Google or Github or {socialPlatform}, and it's not working. Client and Authorization Server are terms found in the OAuth2 spec's section on roles. Errors on the Authorization Server These are often in the form of an invalid_client error code.… Continue reading How to Debug OAuth Auth Code Login Flows
A (Small) Observability 2.0 Success Story
At PMG, we've spent the last few months instrumenting our applications with OpenTelemetry and integrating with a tracing vendor. Part of this, for me, was reading the Observability Engineering book, learning about service level objectives from it, and then reading a SLO book as well. SLOs are very exciting to me, actual relevant alerts based… Continue reading A (Small) Observability 2.0 Success Story
How to Send AWS EventBridge Events to CloudWatch Logs
Ostensibly this is easy. Set an event rule target to a log group and it Just Works (tm). I suspect that's probably the case in the AWS UI, but with infra as code there's a missing piece: cloudwatch logs resource policies. There has to be a policy in place that allows events to delivery logs.… Continue reading How to Send AWS EventBridge Events to CloudWatch Logs
Test Setup and Teardown Methods in Go
Dependency Inversion with Client Side Interfaces in Go
One interesting thing about Go is that it lacks and explicit implements keyword for interfaces. If you want to implement an interface, there's no extra step. As long as function signatures match the interface, or function type declaration in those cases, the interface is implemented. The same could be said of Python protocols too. Coming… Continue reading Dependency Inversion with Client Side Interfaces in Go
Dependency Inversion in Go HTTP Handlers
This post has a lot of Go, but I suspect its relevant to any programming language with first class functions. I've been doing some more work in Go the last month or so. One bit of advice I really like and have been following from how I write HTTP service in Go after 13 years… Continue reading Dependency Inversion in Go HTTP Handlers
Using DataDog Sampling Rules to Exclude Traces
There are some docs on this, but it took way to much trial and error on my part to figure it out, so hopefully this helps some future person (or future me!). The gist of this is there are two ways to exclude traces: on the agent side and on the tracer side. Agent Side… Continue reading Using DataDog Sampling Rules to Exclude Traces
Running Database Integration Tests in Go
I'm working through writing a Go app backed by a PostgreSQL database (using sqlx). Whenever I'm writing code that interacts with a database, I want to make sure that I'm testing against the real thing -- especially when using plain old SQL statements where dialects can differ between databases. One thing I do in PHP… Continue reading Running Database Integration Tests in Go







