build: strip unused mailcap, iana-etc, and tzdata from runtime closure#2
build: strip unused mailcap, iana-etc, and tzdata from runtime closure#2
Conversation
Nixpkgs patches Go's stdlib to reference nix store paths for these packages. None are needed at runtime: mime.TypeByExtension is never called directly, net.LookupPort/LookupProtocol are unused (numeric ports only), and time.LoadLocation is never called. All three use lazy loading with graceful fallback when files are missing. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✅ Files skipped from review due to trivial changes (1)
WalkthroughThe flake.nix modification updates the Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
flake.nix (1)
44-48: Add a lightweight regression guard for the “unused subsystem” assumption.Since this optimization depends on specific APIs remaining unused, add a CI/static check so future changes don’t silently invalidate the premise.
#!/bin/bash set -euo pipefail # Expectation: no matches in non-test Go code. # If any match appears, re-evaluate stripping mailcap/iana-etc/tzdata references. rg -n --type go -g '!**/*_test.go' \ -e '\bmime\.TypeByExtension\s*\(' \ -e '\bnet\.LookupPort\s*\(' \ -e '\bnet\.LookupProtocol\s*\(' \ -e '\btime\.LoadLocation\s*\(' || true🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@flake.nix` around lines 44 - 48, Add a lightweight CI regression guard that fails the build if any non-test Go code starts using the APIs that allowed the mailcap/iana-etc/tzdata stripping: specifically scan for usages of mime.TypeByExtension, net.LookupPort, net.LookupProtocol, or time.LoadLocation and fail the job if matches exist; implement this as a small script/CI step that runs a recursive grep/ripgrep over Go files excluding *_test.go and returns non-zero on any match so future changes that reference those symbols are caught.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@flake.nix`:
- Around line 44-48: Add a lightweight CI regression guard that fails the build
if any non-test Go code starts using the APIs that allowed the
mailcap/iana-etc/tzdata stripping: specifically scan for usages of
mime.TypeByExtension, net.LookupPort, net.LookupProtocol, or time.LoadLocation
and fail the job if matches exist; implement this as a small script/CI step that
runs a recursive grep/ripgrep over Go files excluding *_test.go and returns
non-zero on any match so future changes that reference those symbols are caught.
Nixpkgs patches Go's stdlib to reference nix store paths for these packages. None are needed at runtime: mime.TypeByExtension is never called directly, net.LookupPort/LookupProtocol are unused (numeric ports only), and time.LoadLocation is never called. All three use lazy loading with graceful fallback when files are missing.
Summary by CodeRabbit