You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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):
OS: VERSION="20.04.5 LTS (Focal Fossa)" on Gitpod
Version of Go : 1.19?
Additional context
Add any other context about the problem here.
The goreleaser/goreleaser-action@v2 seems outdated, there is a goreleaser/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:
builds:
- # ID of the build.# Defaults to the binary name.id: "editorconfig-checker"# Path to main.go file or main package.# Notice: when used with `gomod.proxy`, this must be a package.## Default is `.`.main: ./cmd/editorconfig-checkerenv:
- CGO_ENABLED=0goos:
- linux
- windows
- darwingoarch:
- amd64
- arm64
- arm
- 386# Set the modified timestamp on the output binary, typically# you would do this to ensure a build was reproducible. Pass# empty string to skip modifying the output.# Default is empty string, which will be the compile time.mod_timestamp: "{{ .CommitTimestamp }}"flags:
- -trimpath# Custom ldflags templates.# Default is `-s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X main.date={{.Date}} -X main.builtBy=goreleaser`.# The goal of the changes to the default flags is to make reproducible builds.ldflags:
- -s -w -X main.version={{.Version}}
- -X main.commit={{.Commit}} -X main.date={{.CommitDate}}
- -X main.builtBy=goreleaser
However, in the Makefile at the root of the project, the ldflags seems to not apply the version to main, but to cli.
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:
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)?
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: