Skip to content

Add version flag to show the current version of the tool#167

Merged
birdayz merged 2 commits intobirdayz:masterfrom
mxcoder:issue-158--show-version
Nov 3, 2021
Merged

Add version flag to show the current version of the tool#167
birdayz merged 2 commits intobirdayz:masterfrom
mxcoder:issue-158--show-version

Conversation

@mxcoder
Copy link
Copy Markdown
Contributor

@mxcoder mxcoder commented Oct 15, 2021

Hi @birdayz

I finally decided to try a first contribution for this project that has been so useful in the last year of my work.
I'm no go expert but I hope this is a good contribution and a good start.

As requested in #158 this PR:

Output:

$> go build -v -ldflags "-s -w -X main.version=v2.0 -X main.commit=abc" ./cmd/kaf/
$> ./kaf --version
kaf version v2.0 (abc)

@mxcoder mxcoder changed the title #158 Add version flag to show the current version of the tool Add version flag to show the current version of the tool (#158) Oct 15, 2021
@mxcoder mxcoder changed the title Add version flag to show the current version of the tool (#158) Add version flag to show the current version of the tool Oct 15, 2021
@birdayz
Copy link
Copy Markdown
Owner

birdayz commented Oct 20, 2021

mh, currently i release locally by running goreleaser, i guess we either have to add the relevant flags to make release in Makefile, or switch to using a gitlab action to release. i hope to look into it in the next days!

@mxcoder
Copy link
Copy Markdown
Contributor Author

mxcoder commented Oct 20, 2021

I think that if you use goreleaser, even locally, it will use the proper flags according to the git repo:

release:
	goreleaser --rm-dist

This should trigger the build process with the goreleaser defaults, which include the following flags:

# Default is `-s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X main.date={{.Date}} -X main.builtBy=goreleaser`.

@birdayz birdayz merged commit 931fafa into birdayz:master Nov 3, 2021
@birdayz
Copy link
Copy Markdown
Owner

birdayz commented Nov 3, 2021

that's good enough for me - thank you! will cut a new release in the next days.

@mxcoder mxcoder deleted the issue-158--show-version branch November 3, 2021 12:00
@mxcoder
Copy link
Copy Markdown
Contributor Author

mxcoder commented Nov 3, 2021

I'm glad its merged, thanks for the hard work @birdayz .

@birdayz
Copy link
Copy Markdown
Owner

birdayz commented Nov 10, 2021

ran a release, works like a charm:

kaf --version
kaf version 0.1.42 (931fafa)

Thanks!

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