Skip to content

chore: Remove redundant in Go 1.22 loop variables #3537

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

Merged
merged 1 commit into from
Apr 2, 2025
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
3 changes: 2 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ run:
linters:
enable:
- canonicalheader
- copyloopvar
- dogsled
- dupl
- gci
Expand Down Expand Up @@ -42,7 +43,7 @@ linters-settings:
CopyrightDate: "Copyright \\d{4} "
template: |-
{{CopyrightDate}}The go-github AUTHORS. All rights reserved.

Use of this source code is governed by a BSD-style
license that can be found in the LICENSE file.
gosec:
Expand Down
6 changes: 0 additions & 6 deletions github/actions_artifacts_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,6 @@ func TestActionsService_DownloadArtifact(t *testing.T) {
}

for _, tc := range tcs {
tc := tc
t.Run(tc.name, func(t *testing.T) {
t.Parallel()
client, mux, _ := setup(t)
Expand Down Expand Up @@ -351,7 +350,6 @@ func TestActionsService_DownloadArtifact_invalidOwner(t *testing.T) {
}

for _, tc := range tcs {
tc := tc
t.Run(tc.name, func(t *testing.T) {
t.Parallel()
client, _, _ := setup(t)
Expand Down Expand Up @@ -381,7 +379,6 @@ func TestActionsService_DownloadArtifact_invalidRepo(t *testing.T) {
}

for _, tc := range tcs {
tc := tc
t.Run(tc.name, func(t *testing.T) {
t.Parallel()
client, _, _ := setup(t)
Expand Down Expand Up @@ -411,7 +408,6 @@ func TestActionsService_DownloadArtifact_StatusMovedPermanently_dontFollowRedire
}

for _, tc := range tcs {
tc := tc
t.Run(tc.name, func(t *testing.T) {
t.Parallel()
client, mux, _ := setup(t)
Expand Down Expand Up @@ -448,7 +444,6 @@ func TestActionsService_DownloadArtifact_StatusMovedPermanently_followRedirects(
}

for _, tc := range tcs {
tc := tc
t.Run(tc.name, func(t *testing.T) {
t.Parallel()
client, mux, serverURL := setup(t)
Expand Down Expand Up @@ -497,7 +492,6 @@ func TestActionsService_DownloadArtifact_unexpectedCode(t *testing.T) {
}

for _, tc := range tcs {
tc := tc
t.Run(tc.name, func(t *testing.T) {
t.Parallel()
client, mux, serverURL := setup(t)
Expand Down
1 change: 0 additions & 1 deletion github/actions_secrets_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ func TestPublicKey_UnmarshalJSON(t *testing.T) {
}

for name, tt := range testCases {
tt := tt
t.Run(name, func(t *testing.T) {
t.Parallel()
pk := PublicKey{}
Expand Down
4 changes: 0 additions & 4 deletions github/actions_workflow_jobs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,6 @@ func TestActionsService_GetWorkflowJobLogs(t *testing.T) {
}

for _, tc := range tcs {
tc := tc
t.Run(tc.name, func(t *testing.T) {
t.Parallel()
client, mux, _ := setup(t)
Expand Down Expand Up @@ -261,7 +260,6 @@ func TestActionsService_GetWorkflowJobLogs_StatusMovedPermanently_dontFollowRedi
}

for _, tc := range tcs {
tc := tc
t.Run(tc.name, func(t *testing.T) {
t.Parallel()
client, mux, _ := setup(t)
Expand Down Expand Up @@ -298,7 +296,6 @@ func TestActionsService_GetWorkflowJobLogs_StatusMovedPermanently_followRedirect
}

for _, tc := range tcs {
tc := tc
t.Run(tc.name, func(t *testing.T) {
t.Parallel()
client, mux, serverURL := setup(t)
Expand Down Expand Up @@ -351,7 +348,6 @@ func TestActionsService_GetWorkflowJobLogs_unexpectedCode(t *testing.T) {
}

for _, tc := range tcs {
tc := tc
t.Run(tc.name, func(t *testing.T) {
t.Parallel()
client, mux, serverURL := setup(t)
Expand Down
8 changes: 0 additions & 8 deletions github/actions_workflow_runs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,6 @@ func TestActionsService_GetWorkflowRunAttemptLogs(t *testing.T) {
}

for _, tc := range tcs {
tc := tc
t.Run(tc.name, func(t *testing.T) {
t.Parallel()
client, mux, _ := setup(t)
Expand Down Expand Up @@ -256,7 +255,6 @@ func TestActionsService_GetWorkflowRunAttemptLogs_StatusMovedPermanently_dontFol
}

for _, tc := range tcs {
tc := tc
t.Run(tc.name, func(t *testing.T) {
t.Parallel()
client, mux, _ := setup(t)
Expand Down Expand Up @@ -293,7 +291,6 @@ func TestActionsService_GetWorkflowRunAttemptLogs_StatusMovedPermanently_followR
}

for _, tc := range tcs {
tc := tc
t.Run(tc.name, func(t *testing.T) {
t.Parallel()
client, mux, serverURL := setup(t)
Expand Down Expand Up @@ -352,7 +349,6 @@ func TestActionsService_GetWorkflowRunAttemptLogs_unexpectedCode(t *testing.T) {
}

for _, tc := range tcs {
tc := tc
t.Run(tc.name, func(t *testing.T) {
t.Parallel()
client, mux, serverURL := setup(t)
Expand Down Expand Up @@ -521,7 +517,6 @@ func TestActionsService_GetWorkflowRunLogs(t *testing.T) {
}

for _, tc := range tcs {
tc := tc
t.Run(tc.name, func(t *testing.T) {
t.Parallel()
client, mux, _ := setup(t)
Expand Down Expand Up @@ -571,7 +566,6 @@ func TestActionsService_GetWorkflowRunLogs_StatusMovedPermanently_dontFollowRedi
}

for _, tc := range tcs {
tc := tc
t.Run(tc.name, func(t *testing.T) {
t.Parallel()
client, mux, _ := setup(t)
Expand Down Expand Up @@ -608,7 +602,6 @@ func TestActionsService_GetWorkflowRunLogs_StatusMovedPermanently_followRedirect
}

for _, tc := range tcs {
tc := tc
t.Run(tc.name, func(t *testing.T) {
t.Parallel()
client, mux, serverURL := setup(t)
Expand Down Expand Up @@ -667,7 +660,6 @@ func TestActionsService_GetWorkflowRunLogs_unexpectedCode(t *testing.T) {
}

for _, tc := range tcs {
tc := tc
t.Run(tc.name, func(t *testing.T) {
t.Parallel()
client, mux, serverURL := setup(t)
Expand Down
9 changes: 0 additions & 9 deletions github/codespaces_secrets_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ func TestCodespacesService_ListSecrets(t *testing.T) {
}

for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
t.Parallel()
client, mux, _ := setup(t)
Expand Down Expand Up @@ -177,7 +176,6 @@ func TestCodespacesService_GetSecret(t *testing.T) {
}

for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
t.Parallel()
client, mux, _ := setup(t)
Expand Down Expand Up @@ -277,7 +275,6 @@ func TestCodespacesService_CreateOrUpdateSecret(t *testing.T) {
}

for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
t.Parallel()
client, mux, _ := setup(t)
Expand Down Expand Up @@ -364,7 +361,6 @@ func TestCodespacesService_DeleteSecret(t *testing.T) {
}

for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
t.Parallel()
client, mux, _ := setup(t)
Expand Down Expand Up @@ -450,7 +446,6 @@ func TestCodespacesService_GetPublicKey(t *testing.T) {
}

for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
t.Parallel()
client, mux, _ := setup(t)
Expand Down Expand Up @@ -529,7 +524,6 @@ func TestCodespacesService_ListSelectedReposForSecret(t *testing.T) {
}

for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
t.Parallel()
client, mux, _ := setup(t)
Expand Down Expand Up @@ -616,7 +610,6 @@ func TestCodespacesService_SetSelectedReposForSecret(t *testing.T) {
}

for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
t.Parallel()
client, mux, _ := setup(t)
Expand Down Expand Up @@ -684,7 +677,6 @@ func TestCodespacesService_AddSelectedReposForSecret(t *testing.T) {
}

for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
t.Parallel()
client, mux, _ := setup(t)
Expand Down Expand Up @@ -752,7 +744,6 @@ func TestCodespacesService_RemoveSelectedReposFromSecret(t *testing.T) {
}

for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
t.Parallel()
client, mux, _ := setup(t)
Expand Down
1 change: 0 additions & 1 deletion github/copilot_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ func TestCopilotSeatDetails_UnmarshalJSON(t *testing.T) {
}

for _, tc := range tests {
tc := tc
seatDetails := &CopilotSeatDetails{}

t.Run(tc.name, func(t *testing.T) {
Expand Down
6 changes: 0 additions & 6 deletions github/github_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,6 @@ func TestWithEnterpriseURLs(t *testing.T) {
wantUploadURL: "https://cloud-api.custom-upload-url/api/uploads/",
},
} {
test := test
t.Run(test.name, func(t *testing.T) {
t.Parallel()
validate := func(c *Client, err error) {
Expand Down Expand Up @@ -2115,7 +2114,6 @@ func TestCompareHttpResponse(t *testing.T) {
}

for name, tc := range testcases {
tc := tc
t.Run(name, func(t *testing.T) {
t.Parallel()
v := compareHTTPResponse(tc.h1, tc.h2)
Expand Down Expand Up @@ -2274,7 +2272,6 @@ func TestErrorResponse_Is(t *testing.T) {
}

for name, tc := range testcases {
tc := tc
t.Run(name, func(t *testing.T) {
t.Parallel()
if tc.wantSame != err.Is(tc.otherError) {
Expand Down Expand Up @@ -2344,7 +2341,6 @@ func TestRateLimitError_Is(t *testing.T) {
}

for name, tc := range testcases {
tc := tc
t.Run(name, func(t *testing.T) {
t.Parallel()
if tc.wantSame != tc.err.Is(tc.otherError) {
Expand Down Expand Up @@ -2431,7 +2427,6 @@ func TestAbuseRateLimitError_Is(t *testing.T) {
}

for name, tc := range testcases {
tc := tc
t.Run(name, func(t *testing.T) {
t.Parallel()
if tc.wantSame != tc.err.Is(tc.otherError) {
Expand Down Expand Up @@ -2463,7 +2458,6 @@ func TestAcceptedError_Is(t *testing.T) {
}

for name, tc := range testcases {
tc := tc
t.Run(name, func(t *testing.T) {
t.Parallel()
if tc.wantSame != err.Is(tc.otherError) {
Expand Down
1 change: 0 additions & 1 deletion github/messages_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,6 @@ func TestValidatePayload_BadRequestBody(t *testing.T) {
}

for i, tt := range tests {
tt := tt
t.Run(fmt.Sprintf("test #%v", i), func(t *testing.T) {
t.Parallel()
req := &http.Request{
Expand Down
1 change: 0 additions & 1 deletion github/orgs_properties_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,6 @@ func TestCustomPropertyValue_UnmarshalJSON(t *testing.T) {
}

for name, tc := range tests {
tc := tc
t.Run(name, func(t *testing.T) {
t.Parallel()
cpv := &CustomPropertyValue{}
Expand Down
1 change: 0 additions & 1 deletion github/pulls_reviews_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,6 @@ func TestPullRequestReviewRequest_isComfortFadePreview(t *testing.T) {
}}

for _, tc := range tests {
tc := tc
t.Run(tc.name, func(t *testing.T) {
t.Parallel()
gotBool, gotErr := tc.review.isComfortFadePreview()
Expand Down
4 changes: 0 additions & 4 deletions github/repos_commits_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,6 @@ func TestRepositoriesService_CompareCommits(t *testing.T) {
}

for i, sample := range testCases {
sample := sample
t.Run(fmt.Sprintf("case #%v", i+1), func(t *testing.T) {
t.Parallel()
client, mux, _ := setup(t)
Expand Down Expand Up @@ -526,7 +525,6 @@ func TestRepositoriesService_CompareCommitsRaw_diff(t *testing.T) {
}

for i, sample := range testCases {
sample := sample
t.Run(fmt.Sprintf("case #%v", i+1), func(t *testing.T) {
t.Parallel()
client, mux, _ := setup(t)
Expand Down Expand Up @@ -585,7 +583,6 @@ func TestRepositoriesService_CompareCommitsRaw_patch(t *testing.T) {
}

for i, sample := range testCases {
sample := sample
t.Run(fmt.Sprintf("case #%v", i+1), func(t *testing.T) {
t.Parallel()
client, mux, _ := setup(t)
Expand Down Expand Up @@ -632,7 +629,6 @@ func TestRepositoriesService_CompareCommitsRaw_invalid(t *testing.T) {
}

for i, sample := range testCases {
sample := sample
t.Run(fmt.Sprintf("case #%v", i+1), func(t *testing.T) {
t.Parallel()
client, _, _ := setup(t)
Expand Down
3 changes: 0 additions & 3 deletions github/repos_contents_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -722,7 +722,6 @@ func TestRepositoriesService_GetArchiveLink(t *testing.T) {
}

for _, tc := range tcs {
tc := tc
t.Run(tc.name, func(t *testing.T) {
t.Parallel()
client, mux, _ := setup(t)
Expand Down Expand Up @@ -780,7 +779,6 @@ func TestRepositoriesService_GetArchiveLink_StatusMovedPermanently_dontFollowRed
}

for _, tc := range tcs {
tc := tc
t.Run(tc.name, func(t *testing.T) {
t.Parallel()
client, mux, _ := setup(t)
Expand Down Expand Up @@ -816,7 +814,6 @@ func TestRepositoriesService_GetArchiveLink_StatusMovedPermanently_followRedirec
}

for _, tc := range tcs {
tc := tc
t.Run(tc.name, func(t *testing.T) {
t.Parallel()
client, mux, serverURL := setup(t)
Expand Down
1 change: 0 additions & 1 deletion github/repos_environments_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ func TestRequiredReviewer_UnmarshalJSON(t *testing.T) {
}

for name, test := range testCases {
test := test
t.Run(name, func(t *testing.T) {
t.Parallel()
rule := []*RequiredReviewer{}
Expand Down
1 change: 0 additions & 1 deletion github/repos_hooks_deliveries_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,6 @@ var hookDeliveryPayloadTypeToStruct = map[string]interface{}{
func TestHookDelivery_ParsePayload(t *testing.T) {
t.Parallel()
for evt, obj := range hookDeliveryPayloadTypeToStruct {
evt, obj := evt, obj
t.Run(evt, func(t *testing.T) {
t.Parallel()
bs, err := json.Marshal(obj)
Expand Down
Loading
Loading