-
Notifications
You must be signed in to change notification settings - Fork 834
Cleanup the version package #4465
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
Conversation
There was a problem hiding this 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 simplifies the version package by removing unnecessary abstractions and improving code clarity. The changes replace error-based compatibility checking with boolean returns, eliminate the Compatibility interface in favor of a concrete type, and modernize version comparison using the cmp package.
Key changes:
- Replaced
errorreturns withboolin compatibility checking - Removed the
Compatibilityinterface, using*Compatibilityconcrete type instead - Updated version comparison to use
cmp.Comparefor clearer semantics
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| version/version.go | Switched from atomic.Value to sync.Once for string caching; updated Compare to use cmp.Compare and changed parameter type from *Semantic to *Application |
| version/constants.go | Changed GetCompatibility return type from Compatibility to *Compatibility and reordered parameters |
| version/compatibility_test.go | Updated test expectations from error assertions to boolean checks; renamed variables for clarity |
| version/compatibility.go | Removed Compatibility interface and error constants; simplified compatibility logic to return bool instead of error |
| version/application_test.go | Removed compatibility-related test cases following deletion of Compatible method |
| version/application.go | Removed Compatible method and error constants; updated Compare to use cmp.Compare |
| network/peer/peer.go | Updated compatibility checks to use boolean returns and added version logging |
| network/peer/config.go | Changed VersionCompatibility field type from version.Compatibility to *version.Compatibility |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Stephen Buttolph <stephen@avalabs.org>
Why this should be merged
errorwith aboolSemanticBeforeHow this works
A cleanup that I factored out of my wip of the version logging work.
How this was tested
CI
Need to be documented in RELEASES.md?
No