mirror of
				https://github.com/superseriousbusiness/gotosocial.git
				synced 2025-10-31 00:42:24 -05:00 
			
		
		
		
	[chore]: Bump github.com/google/uuid from 1.4.0 to 1.5.0 (#2469)
Bumps [github.com/google/uuid](https://github.com/google/uuid) from 1.4.0 to 1.5.0. - [Release notes](https://github.com/google/uuid/releases) - [Changelog](https://github.com/google/uuid/blob/master/CHANGELOG.md) - [Commits](https://github.com/google/uuid/compare/v1.4.0...v1.5.0) --- updated-dependencies: - dependency-name: github.com/google/uuid dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
This commit is contained in:
		
					parent
					
						
							
								0e56867d8b
							
						
					
				
			
			
				commit
				
					
						d685e86432
					
				
			
		
					 8 changed files with 211 additions and 9 deletions
				
			
		
							
								
								
									
										53
									
								
								vendor/github.com/google/uuid/uuid.go
									
										
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										53
									
								
								vendor/github.com/google/uuid/uuid.go
									
										
									
										generated
									
									
										vendored
									
									
								
							|  | @ -186,6 +186,59 @@ func Must(uuid UUID, err error) UUID { | |||
| 	return uuid | ||||
| } | ||||
| 
 | ||||
| // Validate returns an error if s is not a properly formatted UUID in one of the following formats: | ||||
| //   xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx | ||||
| //   urn:uuid:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx | ||||
| //   xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx | ||||
| //   {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx} | ||||
| // It returns an error if the format is invalid, otherwise nil. | ||||
| func Validate(s string) error { | ||||
| 	switch len(s) { | ||||
| 	// Standard UUID format | ||||
| 	case 36: | ||||
| 
 | ||||
| 	// UUID with "urn:uuid:" prefix | ||||
| 	case 36 + 9: | ||||
| 		if !strings.EqualFold(s[:9], "urn:uuid:") { | ||||
| 			return fmt.Errorf("invalid urn prefix: %q", s[:9]) | ||||
| 		} | ||||
| 		s = s[9:] | ||||
| 
 | ||||
| 	// UUID enclosed in braces | ||||
| 	case 36 + 2: | ||||
| 		if s[0] != '{' || s[len(s)-1] != '}' { | ||||
| 			return fmt.Errorf("invalid bracketed UUID format") | ||||
| 		} | ||||
| 		s = s[1 : len(s)-1] | ||||
| 
 | ||||
| 	// UUID without hyphens | ||||
| 	case 32: | ||||
| 		for i := 0; i < len(s); i += 2 { | ||||
| 			_, ok := xtob(s[i], s[i+1]) | ||||
| 			if !ok { | ||||
| 				return errors.New("invalid UUID format") | ||||
| 			} | ||||
| 		} | ||||
| 
 | ||||
| 	default: | ||||
| 		return invalidLengthError{len(s)} | ||||
| 	} | ||||
| 
 | ||||
| 	// Check for standard UUID format | ||||
| 	if len(s) == 36 { | ||||
| 		if s[8] != '-' || s[13] != '-' || s[18] != '-' || s[23] != '-' { | ||||
| 			return errors.New("invalid UUID format") | ||||
| 		} | ||||
| 		for _, x := range []int{0, 2, 4, 6, 9, 11, 14, 16, 19, 21, 24, 26, 28, 30, 32, 34} { | ||||
| 			if _, ok := xtob(s[x], s[x+1]); !ok { | ||||
| 				return errors.New("invalid UUID format") | ||||
| 			} | ||||
| 		} | ||||
| 	} | ||||
| 
 | ||||
| 	return nil | ||||
| } | ||||
| 
 | ||||
| // String returns the string form of uuid, xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx | ||||
| // , or "" if uuid is invalid. | ||||
| func (uuid UUID) String() string { | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue