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

Use Main.Version to put the versioning #45

Merged
merged 2 commits into from
Apr 7, 2022
Merged

Use Main.Version to put the versioning #45

merged 2 commits into from
Apr 7, 2022

Conversation

sixstone-qq
Copy link

@sixstone-qq sixstone-qq commented Apr 7, 2022

Without this PR, the version has to be set manually before each git tag versioning which becomes outdated (see v0.2.0 on this changeset). In order to let our users known which tool version are using, there is a hkt version command.

In order to fix this, this PR puts versioning dynamically following this flow:

If injected Version is set, use it. If not, read it from runtime.debug.ReadBuildInfo, if not available, just put devel.

@sixstone-qq sixstone-qq added the enhancement New feature or request label Apr 7, 2022
@sixstone-qq sixstone-qq self-assigned this Apr 7, 2022
@sixstone-qq
Copy link
Author

QA:
Using go install:

✦4 ❯ go install github.com/heetch/hkt@put-version
go: downloading github.com/heetch/hkt v0.5.1-0.20220407082758-2ae908d8392f

services/phasing/core on  master [$?] via GO v1.17.1 took 28s
✦4 ❯ hkt version
hkt version v0.5.1-0.20220407082758-2ae908d8392f

Using make build:

✦4 ❯ make build && ./hkt version
go build -ldflags="-X main.Version=v0.5.0-2-g427502f"
hkt version v0.5.0-2-g427502f

@sixstone-qq sixstone-qq requested a review from skateinmars April 7, 2022 08:39
@sixstone-qq sixstone-qq marked this pull request as ready for review April 7, 2022 08:39
@sixstone-qq sixstone-qq merged commit 3583cc6 into master Apr 7, 2022
@sixstone-qq sixstone-qq deleted the put-version branch April 7, 2022 14:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants