New blog post 🥳

Stamp It! All Programs Must Report Their Version

> […]
>
> In this article, I’ll explain how 3 simple steps (Stamp it! Plumb it! Report it!) are sufficient to save you hours of delays and stress during incident response.

Read more: https://michael.stapelberg.ch/posts/2026-04-05-stamp-it-all-programs-must-report-their-version/

#nix #golang #linux

@zekjur

Honestly, we should have that in the go builder by default.

Perhaps even stdenv. We could then have a standard fakegit hook that returns the rev for the common rev checking commands which would work for any build process that does git integration via execve.
Rev info for regular nixpkgs packages with non-flake input srcs would need to be locked along with version and src hash on update; ideally automatically and into a plain JSON file.

@Atemu Are you involved with the Go builder in Nix? :)

Having the workaround enabled by default until a cleaner fix lands (I spotted https://go-review.googlesource.com/c/go/+/762920 earlier today) sounds great to me!

@zekjur @Atemu You can find involved maintainers in https://github.com/NixOS/nixpkgs/commits/master/pkgs/build-support/go but to save you the roundtrip: @katexochen
History for pkgs/build-support/go - NixOS/nixpkgs

Nix Packages collection & NixOS. Contribute to NixOS/nixpkgs development by creating an account on GitHub.

GitHub
@niklaskorz @zekjur @Atemu Yes, I read the article, hadn't had a chance to look at the code yet.
@niklaskorz @zekjur @Atemu I like the proposal of Daniel: https://github.com/golang/go/issues/77020#issuecomment-4195228859
Let's wait and see if we can actually get that as part of 1.27? Then we wouldn't need to implement a temporary workaround in nixpkgs.
proposal: cmd/go: add -buildversion build flag · Issue #77020 · golang/go

Background I yearn for the day debug.BuildInfo.Main.Version is all a binary needs to know its own version. buildInfo, ok := debug.ReadBuildInfo() if !ok { panic("can't retrieve version: this binary...

GitHub