-
Notifications
You must be signed in to change notification settings - Fork 285
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
Missing version output in revive -version
in goreleaser released files
#787
Comments
Hi @echoix, thanks for filling the issue. |
I can make a PR with what I think should minimally work, that is, by porting the flags of the Makefile to the GoReleaser config. If you would like to do a more in-depth fix, it could be done afterwards. Would you also like to modernize the .goreleaser.yml file from what is the new default template (there are some deprecation warnings now)? |
Hi @echoix,
It sound good to me. Thanks! |
Hi @echoix, any progress on the PR ? |
Sorry, not more that what was in my branches at the time. It was fonctionnal, but not the complete upgrade of GoReleaser config I hoped for. |
Describe the bug
A clear and concise description of what the bug is.
The released binaries do not contain a version when calling
revive -version
To Reproduce
Steps to reproduce the behavior:
revive
by the following three methods, and runrevive -version
From the downloaded latest release (linux amd64)
If using the released docker image, (also built by goreleaser):
(Note: I used this dockerfile to have an image where I could call with an entry point)
$ docker run --rm revive:test-echoix sh -c 'revive -version' version (devel)
If building from go install (inside a container)
Expected behavior
A clear and concise description of what you expected to happen.
The released binaries are the same as the ones that we can build locally with the latest available release source code. This means that version returned by
-version
would be the same.Logs
If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
Additional context
Add any other context about the problem here.
The
goreleaser/goreleaser-action@v2
seems outdated, there is agoreleaser/goreleaser-action@v4
By default, (at the latest releases, I don't know about older versions of goreleaser), Goreleaser adds the following ldflags:
-s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X main.date={{.Date}} -X main.builtBy=goreleaser
See also the note on their docs to get reproducible builds https://goreleaser.com/customization/builds/#reproducible-builds
In my try to get editorconfig-checker using goreleaser, the build section looked like this to have reproducible builds:
However, in the Makefile at the root of the project, the
ldflags
seems to not apply the version to main, but tocli
.revive/Makefile
Lines 3 to 9 in a4f4632
Thus, the solution is either to have the project use a main something to be like other default go projects, or to configure the
.goreleaser.yml
to have the same flags if it is what it takes to have a working build:revive/.goreleaser.yml
Lines 16 to 24 in a4f4632
The text was updated successfully, but these errors were encountered: