lotsoftools

Golang UUID V4

This page provides details and a Golang snippet on how to generate a UUID version 4.

package main

import (
"fmt"
"github.com/google/uuid"
)

func main() {
uid := uuid.New()
fmt.Println(uid)
}

This Golang code snippet uses the 'uuid' package from Google. It includes the 'fmt' and 'github.com/google/uuid' libraries at the beginning.

In the main function, it calls the 'uuid.New()' function to generate a new UUID version 4. This generated UUID is then printed to the console using 'fmt.Println' function.