Universal Unique Identifier (UUID)

Overview

This page contains recommendations for using Universal Unique Identifier (UUID).

General

  • Do not use UUID as a random value. UUID is a unique value, not random. There is no a way to guarantee randomness, especially for versions != 4.

  • Do not use UUID as a session identifier.

  • You can use a UUID as a unique value for objects, such as a bank card ID or upload file name.

UUID generation

You can use the google/uuid package to generate UUID values in Go.

import "github.com/google/uuid"

func GenerateNewUUIDValue() string {
    return uuid.New().String()
}

Last updated