Sqlc

Generate code with SQLC in Bazel - update to Bazel 9

As shown in my previous article when using sqlc in a hermetic way - i.e. you want to build sqlc from source instead of relying on some pre-built binary - it requires some adjustments because out of the box, the build will fail.

One of the biggest changes (from what I know so far) in Bazel 9 is that the cc toolchain is now extracted to its own rule (rules_cc). This means that the previous

Generate code with SQLC in Bazel

Bazel (checkout also their new docs) is a build system that advertises itself with

{ Fast, Correct } — Choose two

and that is absolutely correct, as long as we’re talking about execution time, not (necessarily) engineering time 😄

I’ve been trying to learn Bazel for a few months. To achieve this, I’m updating most of my projects to build with Bazel. In my spare time, I work on various small projects, mostly using Go. These range from command-line applications to server apps running in containers, and even a custom GitHub action for installing Hugo.