diff --git a/internal/util/rand/random.go b/internal/util/rand/random.go index 2cfb5cb7cc..015146d498 100644 --- a/internal/util/rand/random.go +++ b/internal/util/rand/random.go @@ -22,9 +22,9 @@ func NewRand(seed int64) *rand.Rand { } // RandomInt returns a random integer between min and max. -func RandomInt(min, max int64, seed int64) int64 { +func RandomInt(minVal, maxVal int64, seed int64) int64 { r := NewRand(seed) - return min + r.Int63n(max-min+1) + return minVal + r.Int63n(maxVal-minVal+1) } // RandomString returns a random string of length n. diff --git a/internal/util/rand/random_test.go b/internal/util/rand/random_test.go index 1653ac45a2..5cb658709b 100644 --- a/internal/util/rand/random_test.go +++ b/internal/util/rand/random_test.go @@ -14,12 +14,12 @@ import ( func TestRandomInt(t *testing.T) { t.Parallel() - min := int64(1) - max := int64(10) + minVal := int64(1) + maxVal := int64(10) seed := int64(12345) - randomInt := rand.RandomInt(min, max, seed) - require.GreaterOrEqual(t, randomInt, min) - require.LessOrEqual(t, randomInt, max) + randomInt := rand.RandomInt(minVal, maxVal, seed) + require.GreaterOrEqual(t, randomInt, minVal) + require.LessOrEqual(t, randomInt, maxVal) } func TestRandomString(t *testing.T) { diff --git a/pkg/profiles/service.go b/pkg/profiles/service.go index f5dab7c177..a24422d78c 100644 --- a/pkg/profiles/service.go +++ b/pkg/profiles/service.go @@ -479,10 +479,10 @@ func getProfileFromPBForUpdateByName( func validateProfileUpdate( old *db.Profile, - new *minderv1.Profile, + newProfile *minderv1.Profile, projectID uuid.UUID, ) error { - if old.Name != new.Name { + if old.Name != newProfile.Name { return util.UserVisibleError(codes.InvalidArgument, "cannot change profile name") } @@ -490,7 +490,7 @@ func validateProfileUpdate( return util.UserVisibleError(codes.InvalidArgument, "cannot change profile project") } - if err := namespaces.ValidateLabelsUpdate(new.GetLabels(), old.Labels); err != nil { + if err := namespaces.ValidateLabelsUpdate(newProfile.GetLabels(), old.Labels); err != nil { return util.UserVisibleError(codes.InvalidArgument, "labels update failed validation: %v", err) }