Golang

golang ai

Embed Codex in your Go application

If you already have a go application with real users, running Codex as a separate tool gets awkward pretty fast. I wanted to run prompts from backend code, stream updates to my own UI, and keep approval behavior under my own control. To make that easier I put …

golang docker

Testing redis in go with docker

If you want to run integration tests in go, and want an easy way to not have to script all the setup and teardown, you can use dockertest helper. It will let you use docker to run services needed for the integration testing, which lets you easily clean up …

golang docker

Docker multistage go build

If you ever had to build a go binary and include it in a docker container, you would either have to do a multi-stage build, which meant you couldn’t use a docker hub automated build, or you had to include the whole build environment in the image, which …

golang testing

Using defer in TestMain

If you’re using TestMain you’ve probably read that you can’t use defer as you need to use os.Exit(m.Run()) to exit from TestMain. The reason for that is that os.Exit() doesn’t honor defer statements. There is an easy way around that, …