golangci-lint: enable int-conversion and fiximports rule of perfsprint

Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
This commit is contained in:
Matthieu MOREL
2024-11-08 22:59:29 +01:00
parent be5f56ab18
commit 05765fb2fd
4 changed files with 13 additions and 5 deletions

View File

@@ -18,6 +18,7 @@ package label
import (
"crypto/sha256"
"encoding/hex"
"fmt"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@@ -38,7 +39,7 @@ func GetValidName(label string) string {
}
sha := sha256.Sum256([]byte(label))
strSha := fmt.Sprintf("%x", sha)
strSha := hex.EncodeToString(sha[:])
charsFromLabel := validation.DNS1035LabelMaxLength - 6
if charsFromLabel < 0 {
// Derive the label name from sha hash in case the DNS1035LabelMaxLength is less than 6