Repository navigation
chore(nix): run deadcode and nilaway with go run, pinned through Renovate - #1052
Merged
Merged
Conversation
numtide/go2nix compiles each Go package in its own derivation, and it cut the Nix rebuild of micasa after a one-file edit from 30 s to under 10 s. We evaluated it as a replacement for buildGoModule and decided not to adopt it yet. This plan records why, so the question is not re-opened without new facts. go2nix needs either a Nix plugin built for the exact evaluating Nix release or three experimental Nix features. Stock Nix in CI and on user machines has neither, so packages.micasa would stop evaluating for everyone else. Its test runner also tests every local package that cmd/micasa reaches, with no way to narrow it, and several of those tests fail under it. Its lockfile-free mode can trust a poisoned hash cache, so the safe mode needs a regenerated lockfile on every go.mod change, which is the same chore vendorHash is today. deadcode and nilaway are pinned third-party tools, so per-package rebuilds give them nothing. The plan lists what an opt-in go2nix output would need and the upstream changes that would justify another look. Generated with Claude Code (claude-opus-5-5) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Every Go or nixpkgs bump made Nix rebuild deadcode and nilaway, often on the first `nix develop` afterwards. CI never used those builds: its lint jobs already run the tools with `go install` and `go run`. The Nix wrappers now run the tools with `go run` too, so Go compiles them once into its own build cache and only a wrapper script comes from Nix. The tools from nixpkgs can't be used instead. These tools read code with the Go version that built them, nixpkgs builds them with Go 1.26, and that deadcode cannot read Go 1.27's standard library. nixpkgs' nilaway is also too old for the flags we pass. golangci-lint can't take over either: its `unused` linter no longer reports unused exported functions, and nilaway only loads into a custom-built binary. Nothing tracked these pins before, so they were bumped by hand. Each pin now sits under a `# renovate:` comment in the wrapper script and in lint.yml, and a regex custom manager matches those comments. Renovate then opens one PR per tool that updates both places, nilaway's pseudo-versions included. Generated with Claude Code (claude-opus-5-5) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
nix develop. CI never used those builds. The Nix wrappers nowgo runa pinned version, as CI already does, so Nix builds only the wrapper scripts.unusedlinter no longer reports unused exported functions, and nilaway only runs in a custom-built golangci-lint.# renovate: datasource=go depName=<module>comment in the wrapper script and inlint.yml, and a regex custom manager matches them. A local Renovate dry run with older pins proposed one update per tool covering both files, nilaway's pseudo-version included.plans/go2nix.mdrecords why micasa stays onbuildGoModule. go2nix cut a one-file Nix rebuild from 30 s to 7-9 s, but it needs a Nix plugin or experimental Nix features, it can't run the same tests, and its lockfile-free mode can trust a poisoned hash cache.🤖 Generated with Claude Code