mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-10-31 10:18:13 +00:00 
			
		
		
		
	hack/update-vendor.sh
This commit is contained in:
		
							
								
								
									
										21
									
								
								vendor/github.com/go-openapi/swag/util.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										21
									
								
								vendor/github.com/go-openapi/swag/util.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -28,6 +28,14 @@ var initialisms []string | ||||
|  | ||||
| var isInitialism func(string) bool | ||||
|  | ||||
| // GoNamePrefixFunc sets an optional rule to prefix go names | ||||
| // which do not start with a letter. | ||||
| // | ||||
| // e.g. to help converting "123" into "{prefix}123" | ||||
| // | ||||
| // The default is to prefix with "X" | ||||
| var GoNamePrefixFunc func(string) string | ||||
|  | ||||
| func init() { | ||||
| 	// Taken from https://github.com/golang/lint/blob/3390df4df2787994aea98de825b964ac7944b817/lint.go#L732-L769 | ||||
| 	var configuredInitialisms = map[string]bool{ | ||||
| @@ -288,8 +296,17 @@ func ToGoName(name string) string { | ||||
| 	} | ||||
|  | ||||
| 	if len(result) > 0 { | ||||
| 		if !unicode.IsUpper([]rune(result)[0]) { | ||||
| 			result = "X" + result | ||||
| 		// Only prefix with X when the first character isn't an ascii letter | ||||
| 		first := []rune(result)[0] | ||||
| 		if !unicode.IsLetter(first) || (first > unicode.MaxASCII && !unicode.IsUpper(first)) { | ||||
| 			if GoNamePrefixFunc == nil { | ||||
| 				return "X" + result | ||||
| 			} | ||||
| 			result = GoNamePrefixFunc(name) + result | ||||
| 		} | ||||
| 		first = []rune(result)[0] | ||||
| 		if unicode.IsLetter(first) && !unicode.IsUpper(first) { | ||||
| 			result = string(append([]rune{unicode.ToUpper(first)}, []rune(result)[1:]...)) | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Jordan Liggitt
					Jordan Liggitt