Last active
June 21, 2026 03:52
-
-
Save up1/19522893a1a0e71a3efc41c135e0754e to your computer and use it in GitHub Desktop.
UUID in go 1.27
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $go install golang.org/dl/go1.27rc1@latest | |
| $go1.27rc1 download | |
| $go version | |
| go version go1.27rc1 darwin/arm64 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "fmt" | |
| "uuid" | |
| ) | |
| func main() { | |
| // Generate a new UUID v7 | |
| id := uuid.NewV7() | |
| fmt.Println(id) | |
| fmt.Println(id.String()) | |
| // Parse a UUID string | |
| _, err := uuid.Parse("550e8400-e29b-41d4-a716-446655440000") | |
| if err != nil { | |
| fmt.Println("invalid") | |
| return | |
| } | |
| fmt.Println("valid") | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment