Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix linting errors for golangci-lint v1.62 #4933

Merged
merged 1 commit into from
Nov 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions internal/util/rand/random.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
10 changes: 5 additions & 5 deletions internal/util/rand/random_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
6 changes: 3 additions & 3 deletions pkg/profiles/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -479,18 +479,18 @@ 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")
}

if old.ProjectID != projectID {
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)
}

Expand Down