mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-06-10 23:57:38 +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:
|
flags:
|
||||||
- -trimpath
|
- -trimpath
|
||||||
ldflags:
|
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:
|
universal_binaries:
|
||||||
- replace: false
|
- replace: false
|
||||||
|
4
main.go
4
main.go
@ -17,6 +17,7 @@ import (
|
|||||||
var (
|
var (
|
||||||
version = ""
|
version = ""
|
||||||
commit = ""
|
commit = ""
|
||||||
|
treeState = ""
|
||||||
date = ""
|
date = ""
|
||||||
builtBy = ""
|
builtBy = ""
|
||||||
)
|
)
|
||||||
@ -55,6 +56,9 @@ func buildVersion(version, commit, date, builtBy string) goversion.Info {
|
|||||||
if commit != "" {
|
if commit != "" {
|
||||||
i.GitCommit = commit
|
i.GitCommit = commit
|
||||||
}
|
}
|
||||||
|
if treeState != "" {
|
||||||
|
i.GitTreeState = treeState
|
||||||
|
}
|
||||||
if date != "" {
|
if date != "" {
|
||||||
i.BuildDate = date
|
i.BuildDate = date
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user