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

Set version with build flags #32

Closed
nunotexbsd opened this issue Mar 21, 2023 · 4 comments
Closed

Set version with build flags #32

nunotexbsd opened this issue Mar 21, 2023 · 4 comments

Comments

@nunotexbsd
Copy link

Hello,

Trying to set version when building with:

## FreeBSD port
DISTVERSION=    1.1.5
GO_BUILDFLAGS=  -ldflags "\
                -w -s \
                -X github.com/b4b4r07/gomi/Version=${DISTVERSION}"

but gomi --version:
unset (unset)

I use this go buildflags on other projects successfully, e.g.:

## gomplate port (https://github.com/hairyhenderson/gomplate)
DISTVERSION=    3.11.4
GO_BUILDFLAGS=  -ldflags "\
                -w -s \
                -X github.com/hairyhenderson/gomplate/v3/version.GitCommit=${GH_TAG_COMMIT} \
                -X github.com/hairyhenderson/gomplate/v3/version.Version=${DISTVERSION}"

Am I missing something?

Thanks

@babarot
Copy link
Owner

babarot commented Mar 21, 2023

@nunotexbsd

$ go build -ldflags "-s -w -X main.Version=v12.34.56 -X main.Revision=foobar"
$ ./gomi --version
v12.34.56 (foobar)

@nunotexbsd
Copy link
Author

@b4b4r07

Fixed!

Does "Revision" have some special meaning or should it be set to "" (empty instead of "unset")?

@babarot
Copy link
Owner

babarot commented Mar 21, 2023

no problem not to set it. Just friendly info

@nunotexbsd
Copy link
Author

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

No branches or pull requests

2 participants