🐿️
Go言語でUUID4をURLフレンドリーなbase64でエンコーデュング
package main
import (
"fmt"
"encoding/base64"
"github.com/google/uuid"
)
func main() {
uuid4 := uuid.New()
uuid4Binary, _ := uuid4.MarshalBinary()
uuid4EncodedBase64 := base64.RawURLEncoding.EncodeToString(uuid4Binary)
fmt.Printf("%#v\n", uuid4EncodedBase64) // gpO_4agsQfarvA4U833MtQ
}
Discussion