Fix lint issues from golangci-lint 1.58.1

This commit is contained in:
Joshua Casey
2024-05-10 14:32:24 -05:00
parent 791b785dea
commit f43b6f04dc
4 changed files with 6 additions and 14 deletions

View File

@@ -166,7 +166,6 @@ func TestMergeIDPConditions(t *testing.T) {
}
for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
var log bytes.Buffer
logger := plog.TestLogger(t, &log)

View File

@@ -1814,7 +1814,6 @@ func TestController(t *testing.T) {
}
for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
t.Parallel()
@@ -1872,7 +1871,7 @@ func TestController(t *testing.T) {
// Verify what's in the cache
actualIDPList := cache.GetGitHubIdentityProviders()
require.Equal(t, len(tt.wantResultingCache), len(actualIDPList))
for i := 0; i < len(tt.wantResultingCache); i++ {
for i := range len(tt.wantResultingCache) {
// Do not expect any particular order in the cache
var actualProvider *upstreamgithub.Provider
for _, possibleIDP := range actualIDPList {
@@ -1907,7 +1906,7 @@ func TestController(t *testing.T) {
require.NoError(t, err)
require.Equal(t, len(tt.wantResultingUpstreams), len(allGitHubIDPs.Items))
for i := 0; i < len(tt.wantResultingUpstreams); i++ {
for i := range len(tt.wantResultingUpstreams) {
require.Len(t, tt.wantResultingUpstreams[i].Status.Conditions, countExpectedConditions)
// Do not expect any particular order in the K8s objects
@@ -1924,7 +1923,7 @@ func TestController(t *testing.T) {
// Update all expected conditions to the frozenTime.
// TODO: Push this out to the test table
for j := 0; j < countExpectedConditions; j++ {
for j := range countExpectedConditions {
// Get this as a pointer so that we can update the value within the array
condition := &tt.wantResultingUpstreams[i].Status.Conditions[j]
condition.LastTransitionTime = metav1.Time{Time: frozenClock.Now()}
@@ -2208,7 +2207,6 @@ func TestController_OnlyWantActions(t *testing.T) {
}
for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
t.Parallel()
@@ -2323,7 +2321,6 @@ func TestGitHubUpstreamWatcherControllerFilterSecret(t *testing.T) {
},
}
for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
t.Parallel()
@@ -2395,7 +2392,6 @@ func TestGitHubUpstreamWatcherControllerFilterGitHubIDP(t *testing.T) {
},
}
for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
t.Parallel()

View File

@@ -35,7 +35,6 @@ func TestGenerateOTPCode(t *testing.T) {
}
for _, test := range tests {
test := test
t.Run(test.name, func(t *testing.T) {
t.Parallel()

View File

@@ -231,7 +231,6 @@ func TestGitHubIDPStaticValidationOnCreate_Parallel(t *testing.T) {
},
}
for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
t.Parallel()
@@ -486,7 +485,6 @@ func TestGitHubIDPPhaseAndConditions_Parallel(t *testing.T) {
},
}
for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
t.Parallel()
@@ -722,9 +720,9 @@ func TestGitHubIDPTooManyOrganizationsStaticValidationOnCreate_Parallel(t *testi
AllowAuthentication: idpv1alpha1.GitHubAllowAuthenticationSpec{
Organizations: idpv1alpha1.GitHubOrganizationsSpec{
Allowed: func() []string {
var orgs []string
for i := 0; i < 100; i++ {
orgs = append(orgs, fmt.Sprintf("org-%d", i))
orgs := make([]string, 100)
for i := range 100 {
orgs[i] = fmt.Sprintf("org-%d", i)
}
return orgs
}(),