The smartid package generates URL and filename safe 160 bit (20 byte) random IDs using URL and Filename safe alphabet [RFC].
Fast and safe. Based on stdlib crypto/rand. No external depdendencies required.
Full go doc: https://pkg.go.dev/github.com/dmasior/smartid
go get github.com/dmasior/smartidimport "github.com/dmasior/smartid"id, err := smartid.New()
if err != nil {
// handle err
}
fmt.Println(id.String())
// print example: 9z4Q7WaUmzQetcj8CCWcKITTg3wid := smartid.MustNew()
fmt.Println(id.String())
// print example: oJemcLfABvB4buGAdXiKd2TJFiEid := smartid.MustNewString()
fmt.Println(id)
// print example: KkdpotMGjcJoBFrDtltifuIDw38