9951 explained code solutions for 126 technologies


golangHow to generate UUID value


This uses uuid module that should be installed by go get github.com/google/uuid command:

package main

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

func main() {
  uid = uuid.New()
}ctrl + c
github.com/google/uuid

module to work with uuid

uuid.New()

init new UUID value

.String()

converts generated UUID to string