You've already forked goreleaser
							
							
				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:
		
							
								
								
									
										4
									
								
								main.go
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								main.go
									
									
									
									
									
								
							| @@ -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), | ||||
|   | ||||
							
								
								
									
										13
									
								
								main_test.go
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								main_test.go
									
									
									
									
									
								
							| @@ -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 | ||||
|   | ||||
							
								
								
									
										2
									
								
								testdata/TestVersion/complete.json.golden
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								testdata/TestVersion/complete.json.golden
									
									
									
									
										vendored
									
									
								
							| @@ -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", | ||||
|   | ||||
		Reference in New Issue
	
	Block a user