do not use fmt.Sprintf() in UUID.String() A single array is used as a buffer and "encoding/hex".Encode() hex encodes directly its final destination. Loops are avoided because they are simple enough to unroll manually.