Add random string to the workflow id

This commit is contained in:
Achim Rohn
2026-04-06 18:34:31 +02:00
parent 9d0733bd96
commit f49871cc1c
2 changed files with 11 additions and 1 deletions
+10
View File
@@ -3,6 +3,7 @@ package ersteller
import (
"bytes"
"fmt"
mathRand "math/rand"
"regexp"
"strings"
"text/template"
@@ -35,3 +36,12 @@ func InlineTemplate(templateString string, data any) string {
}
return buf.String()
}
func RandomString(n int) string {
const letters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
b := make([]byte, n)
for i := range b {
b[i] = letters[int(mathRand.Int63()%int64(len(letters)))]
}
return string(b)
}