Skip to content

Add version flag to CLI and set version during build#6

Merged
JaredHatfield merged 1 commit into
mainfrom
version
Jun 16, 2025
Merged

Add version flag to CLI and set version during build#6
JaredHatfield merged 1 commit into
mainfrom
version

Conversation

@JaredHatfield
Copy link
Copy Markdown
Member

No description provided.

Copilot AI review requested due to automatic review settings June 16, 2025 01:06
Copy link
Copy Markdown

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

Adds a build-time version injection and a CLI flag to display it.

  • Introduces a Version variable and a -version flag in main.go
  • Updates GitHub Actions workflow to pass the Git ref as main.Version via ldflags

Reviewed Changes

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

File Description
main.go Added Version var and -version flag handling
.github/workflows/release-go-github.yml Configured ldflags to set main.Version on build
Comments suppressed due to low confidence (2)

.github/workflows/release-go-github.yml:48

  • The single quotes around main.Version in the ldflags string will be included in the version value. Remove the extra quotes so it reads -X main.Version=${{ github.ref_name }}.
ldflags: "-X 'main.Version=${{ github.ref_name }}'"

main.go:55

  • Add a unit or integration test to verify that running the CLI with -version outputs the injected Version string as expected.
showVersion := flag.Bool("version", false, "Print version")

@codecov
Copy link
Copy Markdown

codecov Bot commented Jun 16, 2025

Codecov Report

Attention: Patch coverage is 0% with 6 lines in your changes missing coverage. Please review.

Project coverage is 6.76%. Comparing base (edeae48) to head (a84655c).

Files with missing lines Patch % Lines
main.go 0.00% 6 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##            main      #6      +/-   ##
========================================
- Coverage   6.81%   6.76%   -0.06%     
========================================
  Files          8       8              
  Lines        763     769       +6     
========================================
  Hits          52      52              
- Misses       707     713       +6     
  Partials       4       4              

☔ 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.

@JaredHatfield JaredHatfield merged commit a475b29 into main Jun 16, 2025
6 of 8 checks passed
@JaredHatfield JaredHatfield deleted the version branch June 16, 2025 01:08
@github-project-automation github-project-automation Bot moved this from Todo to Done in UnitVectorY Labs Jun 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

2 participants