I need to generate an unique file name with UUID1.
My current python code is:
uuid.uuid1().hex[:16] // i need 16 chars file name
What could be the golang equivalent?
Thanks!
I need to generate an unique file name with UUID1.
My current python code is:
uuid.uuid1().hex[:16] // i need 16 chars file name
What could be the golang equivalent?
Thanks!
There isn't a guid or uuid type in the standard library for Go but there are some other ways to do it, like using a third party package such as this; https://godoc.org/code.google.com/p/go-uuid/uuid or https://github.com/nu7hatch/gouuid
import "github.com/nu7hatch/gouuid"
id, err := uuid.NewV4()
This answer has another option as well which makes use of Unix command line utils; Is there a method to generate a UUID with go language though it doesn't seem to perform very well.