Skip to content
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: setting version dynamically #83

Merged
merged 2 commits into from
Mar 28, 2024

Conversation

sunnyguduru
Copy link
Contributor

@sunnyguduru sunnyguduru commented Mar 27, 2024

go releaser sets main.version via ldflag to our tag (with the v removed). I'm making use of this to get the version number dynamically.

Included a test, the test version was set to "test".

If you want to test this locally try

go build -ldflags="-s -w -X main.version=0.2.0"

Then run the generated binary

./ldcli --version

Copy link

This pull request has been linked to Shortcut Story #235710: create global flag to show version.

@sunnyguduru sunnyguduru changed the title Setting version dynamically feat: setting version dynamically Mar 27, 2024
Copy link
Contributor

@dbolson dbolson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you leave a comment where the version var is defined in main that links to the releaser docs?

@sunnyguduru sunnyguduru merged commit 7e4e794 into main Mar 28, 2024
4 checks passed
@sunnyguduru sunnyguduru deleted the sunny/sc-235710/create-global-flag-to-show-version branch March 28, 2024 20:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants