mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-01-26 04:22:05 +02:00
fix: pass tree state as ldflag (#3968)
needs #3967 Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
This commit is contained in:
parent
4330b522ea
commit
45b80dfa26
@ -37,7 +37,7 @@ builds:
|
||||
flags:
|
||||
- -trimpath
|
||||
ldflags:
|
||||
- -s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X main.date={{ .CommitDate }} -X main.builtBy=goreleaser
|
||||
- -s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X main.date={{ .CommitDate }} -X main.builtBy=goreleaser -X main.treeState={{ .IsGitDirty }}
|
||||
|
||||
universal_binaries:
|
||||
- replace: false
|
||||
|
12
main.go
12
main.go
@ -15,10 +15,11 @@ import (
|
||||
|
||||
// nolint: gochecknoglobals
|
||||
var (
|
||||
version = ""
|
||||
commit = ""
|
||||
date = ""
|
||||
builtBy = ""
|
||||
version = ""
|
||||
commit = ""
|
||||
treeState = ""
|
||||
date = ""
|
||||
builtBy = ""
|
||||
)
|
||||
|
||||
func init() {
|
||||
@ -55,6 +56,9 @@ func buildVersion(version, commit, date, builtBy string) goversion.Info {
|
||||
if commit != "" {
|
||||
i.GitCommit = commit
|
||||
}
|
||||
if treeState != "" {
|
||||
i.GitTreeState = treeState
|
||||
}
|
||||
if date != "" {
|
||||
i.BuildDate = date
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user