-
Notifications
You must be signed in to change notification settings - Fork 10
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
feat(main): Add version flag to display application version #45
Conversation
WalkthroughThe pull request updates the build configuration and command-line interface for the capture project. In the Changes
Sequence Diagram(s)sequenceDiagram
participant U as User
participant M as Main Application
U->>M: Execute `capture --version`
M->>M: Parse command-line flags
alt Version flag is set
M->>U: Print version info ("capture version: <version>")
M->>M: Exit application
else
M->>M: Initialize config and continue execution
end
Possibly related issues
Possibly related PRs
Suggested reviewers
Poem
✨ Finishing Touches
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Signed-off-by: Mert Şişmanoğlu <mert190737fb@gmail.com>
7ff9cd0
to
e9f4be0
Compare
- s - w - extldflags static - X main.Version = APP_VERSION Signed-off-by: Mert Şişmanoğlu <mert190737fb@gmail.com>
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.
Actionable comments posted: 1
🧹 Nitpick comments (1)
cmd/capture/main.go (1)
25-32
: Consider using a more standardized version output format.While the version flag implementation is correct, consider using a more standardized format that includes additional build information. This would be helpful for debugging and support.
- fmt.Printf("Capture version: %s\n", Version) + fmt.Printf("capture %s\n", Version)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
.goreleaser.yml
(2 hunks)cmd/capture/main.go
(2 hunks)
🔇 Additional comments (5)
cmd/capture/main.go (3)
5-6
: LGTM!The new imports are correctly added and necessary for the version flag functionality.
20-20
: LGTM!Good change to make appConfig a pointer, allowing for better initialization control.
22-22
: LGTM!The Version variable is well-defined with a clear comment explaining its compile-time modification.
.goreleaser.yml (2)
7-10
: LGTM!The ldflags are well-configured for:
- Optimizing binary size (-s -w)
- Ensuring static linking
- Injecting the version information
41-41
: LGTM!The Version variable injection is correctly configured and consistent with the builds section.
Description of Changes
flag
package to handle command-line flags and a newVersion
variable to store the application's version.-version
) that, when used, prints the application's version and exits.Configuration initialization refactor:
appConfig
variable from a direct initialization to a pointer and moved its initialization inside themain
function.Issue Number
#41
Summary by CodeRabbit
New Features
Chores