mirror of
				https://github.com/optim-enterprises-bv/vault.git
				synced 2025-10-31 10:37:56 +00:00 
			
		
		
		
	Use enumer to generate String() methods for most enums (#25705)
We have many hand-written String() methods (and similar) for enums. These require more maintenance and are more error-prone than using automatically generated methods. In addition, the auto-generated versions can be more efficient. Here, we switch to using https://github.com/loggerhead/enumer, itself a fork of https://github.com/diegostamigni/enumer, no longer maintained, and a fork of the mostly standard tool https://pkg.go.dev/golang.org/x/tools/cmd/stringer. We use this fork of enumer for Go 1.20+ compatibility and because we require the `-transform` flag to be able to generate constants that match our current code base. Some enums were not targeted for this change:
This commit is contained in:
		 Christopher Swenson
					Christopher Swenson
				
			
				
					committed by
					
						 GitHub
						GitHub
					
				
			
			
				
	
			
			
			 GitHub
						GitHub
					
				
			
						parent
						
							55241c2b09
						
					
				
				
					commit
					961bf20bdb
				
			| @@ -23,6 +23,7 @@ var ( | ||||
| 	_ cli.CommandAutocomplete = (*OperatorGenerateRootCommand)(nil) | ||||
| ) | ||||
|  | ||||
| //go:generate enumer -type=generateRootKind -trimprefix=generateRoot | ||||
| type generateRootKind int | ||||
|  | ||||
| const ( | ||||
|   | ||||
		Reference in New Issue
	
	Block a user