Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1457 +/- ##
==========================================
+ Coverage 90.87% 90.99% +0.11%
==========================================
Files 86 86
Lines 17924 18182 +258
==========================================
+ Hits 16289 16545 +256
- Misses 1635 1637 +2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
📦 Cargo Bloat ComparisonBinary size change: +0.00% (22.8 MiB → 22.8 MiB) Expand for cargo-bloat outputHead Branch ResultsBase Branch Results |
There was a problem hiding this comment.
Pull request overview
This PR implements automatic extraction of Go version constraints from go.mod files for remote hooks, addressing issue #987. Previously, users had to manually specify language_version for Go hooks when the remote hook required a specific Go version; now prek automatically reads the go or toolchain directives from the remote hook's go.mod file.
Changes:
- Implemented
go.modparsing to extractgoandtoolchaindirectives - Added version normalization to convert Go versions (e.g., "1.23") to semver ranges (e.g., ">= 1.23.0")
- Enhanced error messages in the Go installer to include the version constraint being resolved
- Added
Displayimplementation forGoRequestto support better error messages - Added comprehensive unit tests for parsing, normalization, and Display implementation
- Added integration test verifying the end-to-end flow with an unrealistic version
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| crates/prek/src/languages/golang/gomod.rs | Implements parsing of go.mod files to extract go and toolchain directives, version normalization, and integration with hook metadata extraction |
| crates/prek/src/languages/golang/version.rs | Adds Display implementation for GoRequest enum and comprehensive unit tests for parsing, matching, and display functionality |
| crates/prek/src/languages/golang/installer.rs | Improves error messages to include the version constraint being resolved |
| crates/prek/tests/languages/golang.rs | Adds integration test verifying automatic version extraction from remote hook's go.mod file |
Closes #987