24 minutes ago · Tech · hide

When folks build Nix packages, it usually builds them from the source code itself, not in a Git checkout. This means that when you're building tools that use the Git checkout to determine what version of the code you're running - like I'd detailed in Getting a --version flag for Cobra CLIs in Go - this doesn't actually work for Nix users, as there's no .git to look for. This is something we'd hit in the past with oapi-codegen, where we exposed a new option that could be configured by someone building the project. If you're using tools like goreleaser, you can take advantage of a fairly common practice in the Go community, to use the main.version ldflag. This means that someone building your tool can run i.e. go build -ldflags='-X main.version=1.2.3' ./cmd/renovate-pretty-logThis requires a few code changes to make this work. Firstly, in the main package for your tool, you need to expose a version variable, which will then be provided by -X main.version: package main // ... var ( //…

Commenting on Bubbles has been removed. Why? If you want to talk about this post, write to the author, use the comments on their blog if it has them, or reply with a "RE:" post on your own blog. Suggestions? feedback@bubbles.town