Skip to content

fix(nix): improve nix-hash check #5883

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 4, 2025
Merged

fix(nix): improve nix-hash check #5883

merged 2 commits into from
Jul 4, 2025

Conversation

caarlos0
Copy link
Member

@caarlos0 caarlos0 commented Jul 4, 2025

currently, it would give a warning when running goreleaser hc, but wouldn't actually fail the check, as the pipe was being skipped if nix-hash wasn't available.

this fixes it, so it checks on run instead.

currently, it would give a warning when running goreleaser hc, but wouldn't
actually fail the check, as the pipe was being skipped if nix-hash wasn't
available.

this fixes it, so it checks on run instead.

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
@caarlos0 caarlos0 self-assigned this Jul 4, 2025
@caarlos0 caarlos0 added the bug Something isn't working label Jul 4, 2025
@caarlos0 caarlos0 requested a review from Copilot July 4, 2025 18:06
@pull-request-size pull-request-size bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Jul 4, 2025
Copy link

cloudflare-workers-and-pages bot commented Jul 4, 2025

Deploying goreleaser with  Cloudflare Pages  Cloudflare Pages

Latest commit: 494cbba
Status: ✅  Deploy successful!
Preview URL: https://6f6dbfa1.goreleaser.pages.dev
Branch Preview URL: https://improve-nix-hash-handling.goreleaser.pages.dev

View logs

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR ensures that the Nix hash availability check fails at runtime instead of merely warning, by moving the availability check into Run, updating dependencies, and improving related tests.

  • Switches the declared dependency from a hardcoded "nix-hash" to the nixHashBin constant.
  • Removes hasher.Available() from Skip and adds an explicit availability check in Run that returns a skip error.
  • Updates tests: removes the old skip check, adds TestRunSkipNoNix, and defines unavailableHasher.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
internal/pipe/nix/nix.go Updated Dependencies, simplified Skip, added availability check in Run
internal/pipe/nix/nix_test.go Removed outdated skip test, added TestRunSkipNoNix and unavailableHasher implementation
Comments suppressed due to low confidence (2)

internal/pipe/nix/nix.go:69

  • Consider adding a unit test for Dependencies to assert it returns the expected nixHashBin value, ensuring future changes don’t break this contract.
func (Pipe) Dependencies(_ *context.Context) []string { return []string{nixHashBin} }

internal/pipe/nix/nix_test.go:691

  • [nitpick] The test-only type unavailableHasher could be renamed to testUnavailableHasher to clarify its purpose and avoid confusion with production types.
type unavailableHasher struct{}

Copy link

codecov bot commented Jul 4, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 82.68%. Comparing base (cb8b6f0) to head (494cbba).
Report is 4 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5883      +/-   ##
==========================================
- Coverage   82.71%   82.68%   -0.04%     
==========================================
  Files         165      165              
  Lines       16521    16521              
==========================================
- Hits        13666    13661       -5     
- Misses       2262     2268       +6     
+ Partials      593      592       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@caarlos0 caarlos0 merged commit 735ed6f into main Jul 4, 2025
16 of 17 checks passed
@caarlos0 caarlos0 deleted the improve-nix-hash-handling branch July 4, 2025 22:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant