Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@Adron
Created March 13, 2017 20:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Adron/c7225ebc07058f443482925a4565afee to your computer and use it in GitHub Desktop.
Save Adron/c7225ebc07058f443482925a4565afee to your computer and use it in GitHub Desktop.
Go UUID Creation
package main
import (
"fmt"
"github.com/satori/go.uuid"
)
func main() {
// Creating UUID Version 4
u1 := uuid.NewV4()
fmt.Printf("UUIDv4: %s\n", u1)
// Parsing UUID from string input
u2, err := uuid.FromString("6ba7b810-9dad-11d1-80b4-00c04fd430c8")
if err != nil {
fmt.Printf("Something gone wrong: %s", err)
}
fmt.Printf("Successfully parsed: %s", u2)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment