1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-10-30 23:58:09 +02:00

fix: version git tree state

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
This commit is contained in:
Carlos Alexandro Becker
2023-06-27 11:35:06 +00:00
parent c9eff90a62
commit 323dca8048
3 changed files with 10 additions and 9 deletions

View File

@@ -37,7 +37,7 @@ func init() {
func main() {
cmd.Execute(
buildVersion(version, commit, date, builtBy),
buildVersion(version, commit, date, builtBy, treeState),
os.Exit,
os.Args[1:],
)
@@ -48,7 +48,7 @@ const website = "https://goreleaser.com"
//go:embed art.txt
var asciiArt string
func buildVersion(version, commit, date, builtBy string) goversion.Info {
func buildVersion(version, commit, date, builtBy, treeState string) goversion.Info {
return goversion.GetVersionInfo(
goversion.WithAppDetails("goreleaser", "Deliver Go Binaries as fast and easily as possible", website),
goversion.WithASCIIName(asciiArt),

View File

@@ -13,14 +13,15 @@ func TestVersion(t *testing.T) {
const platform = "linux/amd64"
for name, tt := range map[string]struct {
version, commit, date, builtBy string
version, commit, date, builtBy, treeState string
}{
"all empty": {},
"complete": {
version: "1.2.3",
date: "12/12/12",
commit: "aaaa",
builtBy: "me",
version: "1.2.3",
date: "12/12/12",
commit: "aaaa",
builtBy: "me",
treeState: "clean",
},
"only version": {
version: "1.2.3",
@@ -37,7 +38,7 @@ func TestVersion(t *testing.T) {
} {
tt := tt
t.Run(name, func(t *testing.T) {
v := buildVersion(tt.version, tt.commit, tt.date, tt.builtBy)
v := buildVersion(tt.version, tt.commit, tt.date, tt.builtBy, tt.treeState)
v.GoVersion = goVersion
v.Compiler = compiler
v.Platform = platform

View File

@@ -2,7 +2,7 @@
"gitVersion": "1.2.3",
"moduleCheksum": "unknown",
"gitCommit": "aaaa",
"gitTreeState": "unknown",
"gitTreeState": "clean",
"buildDate": "12/12/12",
"builtBy": "me",
"goVersion": "go1.20.3",