You've already forked goreleaser
							
							
				mirror of
				https://github.com/goreleaser/goreleaser.git
				synced 2025-10-30 23:58:09 +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:
		
				
					committed by
					
						 GitHub
						GitHub
					
				
			
			
				
	
			
			
			
						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 | ||||
| 			} | ||||
|   | ||||
		Reference in New Issue
	
	Block a user