9951 explained code solutions for 126 technologies


golangHow to generate UUID and convert it to string


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() {
  string_uuid = (uuid.New()).String()
}ctrl + c
github.com/google/uuid

module to work with uuid

uuid.New()

init new UUID value

.String()

converts generated UUID to string