Skip to content

Fix for --version in osctrl-api and osctrl-cli#677

Merged
javuto merged 1 commit intomainfrom
version-cli-api-fix
Aug 15, 2025
Merged

Fix for --version in osctrl-api and osctrl-cli#677
javuto merged 1 commit intomainfrom
version-cli-api-fix

Conversation

@javuto
Copy link
Collaborator

@javuto javuto commented Aug 15, 2025

Fix for osctrl-api and osctrl-cli to print out the version and exit when issuing the -v, --version flag. Also adding metadata to build.

@javuto javuto requested a review from Copilot August 15, 2025 13:08
@javuto javuto added osctrl-api osctrl-api related changes osctrl-cli osctrl-cli related changes 📦 build Building related issues labels Aug 15, 2025
Copy link
Contributor

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 fixes the --version flag functionality for both osctrl-api and osctrl-cli commands by implementing proper version handling and adding build metadata support. The changes enable these tools to print version information and exit when the -v or --version flag is used.

  • Adds build-time metadata variables for version, commit, and build date in both CLI and API main files
  • Implements custom version printing with enhanced format showing version, commit, and date
  • Updates build configuration to inject build metadata via ldflags

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
cmd/cli/main.go Adds build metadata variables and custom version flag handling with -v alias
cmd/api/main.go Adds build metadata variables, custom version handling, and restructures app action to prevent service startup on version requests
Makefile Updates build targets to include build args and fixes test path reference
.goreleaser.yml Updates ldflags to use new build metadata variable names

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@javuto javuto merged commit cdb8322 into main Aug 15, 2025
55 checks passed
@javuto javuto deleted the version-cli-api-fix branch August 15, 2025 13:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

📦 build Building related issues osctrl-api osctrl-api related changes osctrl-cli osctrl-cli related changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants