Skip to content

Commit ff1666c

Browse files
authored
refactor: Fix revive.unnecessary-format lint issues (#3629)
1 parent 18877d9 commit ff1666c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+219
-218
lines changed

.custom-gcl.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version: v2.1.6
1+
version: v2.2.2
22
plugins:
33
- module: "github.com/google/go-github/v68/tools/sliceofpointers"
44
path: ./tools/sliceofpointers

.golangci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ linters:
9797
- name: time-naming
9898
- name: unexported-naming
9999
- name: unexported-return
100+
- name: unnecessary-format
100101
- name: unreachable-code
101102
- name: unused-parameter
102103
- name: use-any

example/commitpr/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ func main() {
218218
log.Fatalf("Unable to get/create the commit reference: %s\n", err)
219219
}
220220
if ref == nil {
221-
log.Fatalf("No error where returned but the reference is nil")
221+
log.Fatal("No error where returned but the reference is nil")
222222
}
223223

224224
tree, err := getTree(ref)

example/verifyartifact/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ func runVerification(sev *verify.SignedEntityVerifier, pb *verify.PolicyBuilder,
186186
return err
187187
}
188188

189-
fmt.Fprintf(os.Stderr, "Verification successful!\n")
189+
fmt.Fprint(os.Stderr, "Verification successful!\n")
190190

191191
marshaled, err := json.MarshalIndent(res, "", " ")
192192
if err != nil {

github/actions_artifacts_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ func TestActionsService_ListArtifacts_notFound(t *testing.T) {
9292
ctx := context.Background()
9393
artifacts, resp, err := client.Actions.ListArtifacts(ctx, "o", "r", nil)
9494
if err == nil {
95-
t.Errorf("Expected HTTP 404 response")
95+
t.Error("Expected HTTP 404 response")
9696
}
9797
if got, want := resp.Response.StatusCode, http.StatusNotFound; got != want {
9898
t.Errorf("Actions.ListArtifacts return status %d, want %d", got, want)
@@ -174,7 +174,7 @@ func TestActionsService_ListWorkflowRunArtifacts_notFound(t *testing.T) {
174174
ctx := context.Background()
175175
artifacts, resp, err := client.Actions.ListWorkflowRunArtifacts(ctx, "o", "r", 1, nil)
176176
if err == nil {
177-
t.Errorf("Expected HTTP 404 response")
177+
t.Error("Expected HTTP 404 response")
178178
}
179179
if got, want := resp.Response.StatusCode, http.StatusNotFound; got != want {
180180
t.Errorf("Actions.ListWorkflowRunArtifacts return status %d, want %d", got, want)
@@ -261,7 +261,7 @@ func TestActionsService_GetArtifact_notFound(t *testing.T) {
261261
ctx := context.Background()
262262
artifact, resp, err := client.Actions.GetArtifact(ctx, "o", "r", 1)
263263
if err == nil {
264-
t.Errorf("Expected HTTP 404 response")
264+
t.Error("Expected HTTP 404 response")
265265
}
266266
if got, want := resp.Response.StatusCode, http.StatusNotFound; got != want {
267267
t.Errorf("Actions.GetArtifact return status %d, want %d", got, want)
@@ -510,7 +510,7 @@ func TestActionsService_DownloadArtifact_unexpectedCode(t *testing.T) {
510510
ctx := context.Background()
511511
url, resp, err := client.Actions.DownloadArtifact(ctx, "o", "r", 1, 1)
512512
if err == nil {
513-
t.Fatalf("Actions.DownloadArtifact should return error on unexpected code")
513+
t.Fatal("Actions.DownloadArtifact should return error on unexpected code")
514514
}
515515
if !strings.Contains(err.Error(), "unexpected status code") {
516516
t.Error("Actions.DownloadArtifact should return unexpected status code")
@@ -580,7 +580,7 @@ func TestActionsService_DeleteArtifact_notFound(t *testing.T) {
580580
ctx := context.Background()
581581
resp, err := client.Actions.DeleteArtifact(ctx, "o", "r", 1)
582582
if err == nil {
583-
t.Errorf("Expected HTTP 404 response")
583+
t.Error("Expected HTTP 404 response")
584584
}
585585
if got, want := resp.Response.StatusCode, http.StatusNotFound; got != want {
586586
t.Errorf("Actions.DeleteArtifact return status %d, want %d", got, want)

github/actions_cache_test.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ func TestActionsService_ListCaches_notFound(t *testing.T) {
8686
ctx := context.Background()
8787
caches, resp, err := client.Actions.ListCaches(ctx, "o", "r", nil)
8888
if err == nil {
89-
t.Errorf("Expected HTTP 404 response")
89+
t.Error("Expected HTTP 404 response")
9090
}
9191
if got, want := resp.Response.StatusCode, http.StatusNotFound; got != want {
9292
t.Errorf("Actions.ListCaches return status %d, want %d", got, want)
@@ -151,7 +151,7 @@ func TestActionsService_DeleteCachesByKey_notFound(t *testing.T) {
151151
ctx := context.Background()
152152
resp, err := client.Actions.DeleteCachesByKey(ctx, "o", "r", "1", Ptr("main"))
153153
if err == nil {
154-
t.Errorf("Expected HTTP 404 response")
154+
t.Error("Expected HTTP 404 response")
155155
}
156156
if got, want := resp.Response.StatusCode, http.StatusNotFound; got != want {
157157
t.Errorf("Actions.DeleteCachesByKey return status %d, want %d", got, want)
@@ -213,7 +213,7 @@ func TestActionsService_DeleteCachesByID_notFound(t *testing.T) {
213213
ctx := context.Background()
214214
resp, err := client.Actions.DeleteCachesByID(ctx, "o", "r", 1)
215215
if err == nil {
216-
t.Errorf("Expected HTTP 404 response")
216+
t.Error("Expected HTTP 404 response")
217217
}
218218
if got, want := resp.Response.StatusCode, http.StatusNotFound; got != want {
219219
t.Errorf("Actions.DeleteCachesByID return status %d, want %d", got, want)
@@ -291,7 +291,7 @@ func TestActionsService_GetCacheUsageForRepo_notFound(t *testing.T) {
291291
ctx := context.Background()
292292
caches, resp, err := client.Actions.GetCacheUsageForRepo(ctx, "o", "r")
293293
if err == nil {
294-
t.Errorf("Expected HTTP 404 response")
294+
t.Error("Expected HTTP 404 response")
295295
}
296296
if got, want := resp.Response.StatusCode, http.StatusNotFound; got != want {
297297
t.Errorf("Actions.GetCacheUsageForRepo return status %d, want %d", got, want)
@@ -364,7 +364,7 @@ func TestActionsService_ListCacheUsageByRepoForOrg_notFound(t *testing.T) {
364364
ctx := context.Background()
365365
caches, resp, err := client.Actions.ListCacheUsageByRepoForOrg(ctx, "o", nil)
366366
if err == nil {
367-
t.Errorf("Expected HTTP 404 response")
367+
t.Error("Expected HTTP 404 response")
368368
}
369369
if got, want := resp.Response.StatusCode, http.StatusNotFound; got != want {
370370
t.Errorf("Actions.ListCacheUsageByRepoForOrg return status %d, want %d", got, want)
@@ -435,7 +435,7 @@ func TestActionsService_GetCacheUsageForOrg_notFound(t *testing.T) {
435435
ctx := context.Background()
436436
caches, resp, err := client.Actions.GetTotalCacheUsageForOrg(ctx, "o")
437437
if err == nil {
438-
t.Errorf("Expected HTTP 404 response")
438+
t.Error("Expected HTTP 404 response")
439439
}
440440
if got, want := resp.Response.StatusCode, http.StatusNotFound; got != want {
441441
t.Errorf("Actions.GetTotalCacheUsageForOrg return status %d, want %d", got, want)
@@ -506,7 +506,7 @@ func TestActionsService_GetCacheUsageForEnterprise_notFound(t *testing.T) {
506506
ctx := context.Background()
507507
caches, resp, err := client.Actions.GetTotalCacheUsageForEnterprise(ctx, "o")
508508
if err == nil {
509-
t.Errorf("Expected HTTP 404 response")
509+
t.Error("Expected HTTP 404 response")
510510
}
511511
if got, want := resp.Response.StatusCode, http.StatusNotFound; got != want {
512512
t.Errorf("Actions.GetTotalCacheUsageForEnterprise return status %d, want %d", got, want)

github/actions_secrets_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ func TestPublicKey_UnmarshalJSON(t *testing.T) {
8181
pk := PublicKey{}
8282
err := json.Unmarshal(tt.data, &pk)
8383
if err == nil && tt.wantErr {
84-
t.Errorf("PublicKey.UnmarshalJSON returned nil instead of an error")
84+
t.Error("PublicKey.UnmarshalJSON returned nil instead of an error")
8585
}
8686
if err != nil && !tt.wantErr {
8787
t.Errorf("PublicKey.UnmarshalJSON returned an unexpected error: %+v", err)
@@ -507,7 +507,7 @@ func TestActionsService_ListSelectedReposForOrgSecret(t *testing.T) {
507507

508508
mux.HandleFunc("/orgs/o/actions/secrets/NAME/repositories", func(w http.ResponseWriter, r *http.Request) {
509509
testMethod(t, r, "GET")
510-
fmt.Fprintf(w, `{"total_count":1,"repositories":[{"id":1}]}`)
510+
fmt.Fprint(w, `{"total_count":1,"repositories":[{"id":1}]}`)
511511
})
512512

513513
opts := &ListOptions{Page: 2, PerPage: 2}

github/actions_variables_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ func TestActionsService_ListSelectedReposForOrgVariable(t *testing.T) {
390390

391391
mux.HandleFunc("/orgs/o/actions/variables/NAME/repositories", func(w http.ResponseWriter, r *http.Request) {
392392
testMethod(t, r, "GET")
393-
fmt.Fprintf(w, `{"total_count":1,"repositories":[{"id":1}]}`)
393+
fmt.Fprint(w, `{"total_count":1,"repositories":[{"id":1}]}`)
394394
})
395395

396396
opts := &ListOptions{Page: 2, PerPage: 2}

github/actions_workflow_jobs_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ func TestActionsService_GetWorkflowJobLogs_unexpectedCode(t *testing.T) {
368368
ctx := context.Background()
369369
url, resp, err := client.Actions.GetWorkflowJobLogs(ctx, "o", "r", 399444496, 1)
370370
if err == nil {
371-
t.Fatalf("Actions.GetWorkflowJobLogs should return error on unexpected code")
371+
t.Fatal("Actions.GetWorkflowJobLogs should return error on unexpected code")
372372
}
373373
if !strings.Contains(err.Error(), "unexpected status code") {
374374
t.Error("Actions.GetWorkflowJobLogs should return unexpected status code")

github/actions_workflow_runs_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ func TestActionsService_GetWorkflowRunAttemptLogs_unexpectedCode(t *testing.T) {
369369
ctx := context.Background()
370370
url, resp, err := client.Actions.GetWorkflowRunAttemptLogs(ctx, "o", "r", 399444496, 2, 1)
371371
if err == nil {
372-
t.Fatalf("Actions.GetWorkflowRunAttemptLogs should return error on unexpected code")
372+
t.Fatal("Actions.GetWorkflowRunAttemptLogs should return error on unexpected code")
373373
}
374374
if !strings.Contains(err.Error(), "unexpected status code") {
375375
t.Error("Actions.GetWorkflowRunAttemptLogs should return unexpected status code")
@@ -680,7 +680,7 @@ func TestActionsService_GetWorkflowRunLogs_unexpectedCode(t *testing.T) {
680680
ctx := context.Background()
681681
url, resp, err := client.Actions.GetWorkflowRunLogs(ctx, "o", "r", 399444496, 1)
682682
if err == nil {
683-
t.Fatalf("Actions.GetWorkflowRunLogs should return error on unexpected code")
683+
t.Fatal("Actions.GetWorkflowRunLogs should return error on unexpected code")
684684
}
685685
if !strings.Contains(err.Error(), "unexpected status code") {
686686
t.Error("Actions.GetWorkflowRunLogs should return unexpected status code")

0 commit comments

Comments
 (0)