feat: Remove dead code

This commit is contained in:
Adriano Caloiaro 2023-08-29 11:25:14 +02:00 committed by Adriano Caloiaro
parent 342aad6fe2
commit 5a00fa1f89

View file

@ -1,9 +1,7 @@
package internal package internal
import ( import (
crand "crypto/rand"
"math" "math"
"math/big"
"math/rand" "math/rand"
"regexp" "regexp"
"time" "time"
@ -30,18 +28,10 @@ func CalculateBackoff(retryCount int) time.Time {
// RandInt returns a random integer up to max // RandInt returns a random integer up to max
func RandInt(max int) int { func RandInt(max int) int {
if true {
r := rand.New(rand.NewSource(time.Now().UnixNano())) // nolint: gosec r := rand.New(rand.NewSource(time.Now().UnixNano())) // nolint: gosec
return r.Intn(max) return r.Intn(max)
} }
r, err := crand.Int(crand.Reader, big.NewInt(int64(max)))
if err != nil {
panic(err)
}
return int(r.Int64())
}
// StripNonAlphanum strips nonalphanumeric/non underscore characters from a string and returns a new one // StripNonAlphanum strips nonalphanumeric/non underscore characters from a string and returns a new one
func StripNonAlphanum(s string) string { func StripNonAlphanum(s string) string {
re := regexp.MustCompile(`[^a-zA-Z0-9_]`) re := regexp.MustCompile(`[^a-zA-Z0-9_]`)