Skip to content

Commit 468780b

Browse files
lint fixes, mostly gofumpt and gosec exemptions
1 parent ebba55a commit 468780b

32 files changed

Lines changed: 110 additions & 110 deletions

File tree

‎pkg/commands/auth/metadata_test.go‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ func TestAuthShow(t *testing.T) {
267267
Auth: config.Auth{
268268
Default: "mytoken",
269269
Tokens: config.AuthTokens{
270-
"mytoken": &config.AuthToken{
270+
"mytoken": &config.AuthToken{ // #nosec G101 (CWE-798)
271271
Type: config.AuthTokenTypeStatic,
272272
Token: "test-token-value",
273273
Email: "alice@example.com",
@@ -495,7 +495,7 @@ func TestEnrichWithTokenSelfPreservesOnFailure(t *testing.T) {
495495
},
496496
})
497497

498-
at := &config.AuthToken{
498+
at := &config.AuthToken{ // #nosec G101 (CWE-798)
499499
Token: "existing-token",
500500
APITokenName: "original-name",
501501
APITokenScope: "global",

‎pkg/commands/auth/revoke_test.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ func TestAuthRevoke(t *testing.T) {
235235
Default: "other",
236236
Tokens: config.AuthTokens{
237237
"other": &config.AuthToken{Type: config.AuthTokenTypeStatic, Token: "other-tok"},
238-
"target": &config.AuthToken{Type: config.AuthTokenTypeStatic, Token: "tok-from-stdin"},
238+
"target": &config.AuthToken{Type: config.AuthTokenTypeStatic, Token: "tok-from-stdin"}, // #nosec G101 (CWE-798)
239239
},
240240
},
241241
},

‎pkg/commands/auth/sso_test.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -670,7 +670,7 @@ func TestSSO(t *testing.T) {
670670
Result: result,
671671
}
672672
go func() {
673-
result <- auth.AuthorizationResult{
673+
result <- auth.AuthorizationResult{ // #nosec G101 (CWE-798)
674674
SessionToken: "sso-env-token",
675675
}
676676
}()

‎pkg/commands/compute/computeacl/computeacl_test.go‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ func TestComputeACLCreate(t *testing.T) {
5353
Response: &http.Response{
5454
StatusCode: http.StatusOK,
5555
Status: http.StatusText(http.StatusOK),
56-
Body: io.NopCloser(bytes.NewReader((testutil.GenJSON(acl)))),
56+
Body: io.NopCloser(bytes.NewReader(testutil.GenJSON(acl))),
5757
},
5858
},
5959
},
@@ -181,7 +181,7 @@ func TestComputeACLDescribe(t *testing.T) {
181181
Response: &http.Response{
182182
StatusCode: http.StatusOK,
183183
Status: http.StatusText(http.StatusOK),
184-
Body: io.NopCloser(bytes.NewReader((testutil.GenJSON(acl)))),
184+
Body: io.NopCloser(bytes.NewReader(testutil.GenJSON(acl))),
185185
},
186186
},
187187
},
@@ -195,7 +195,7 @@ func TestComputeACLDescribe(t *testing.T) {
195195
Response: &http.Response{
196196
StatusCode: http.StatusOK,
197197
Status: http.StatusText(http.StatusOK),
198-
Body: io.NopCloser(bytes.NewReader((testutil.GenJSON(acl)))),
198+
Body: io.NopCloser(bytes.NewReader(testutil.GenJSON(acl))),
199199
},
200200
},
201201
},
@@ -364,7 +364,7 @@ func TestComputeACLLookup(t *testing.T) {
364364
Response: &http.Response{
365365
StatusCode: http.StatusOK,
366366
Status: http.StatusText(http.StatusOK),
367-
Body: io.NopCloser(bytes.NewReader((testutil.GenJSON(entry)))),
367+
Body: io.NopCloser(bytes.NewReader(testutil.GenJSON(entry))),
368368
},
369369
},
370370
},
@@ -378,7 +378,7 @@ func TestComputeACLLookup(t *testing.T) {
378378
Response: &http.Response{
379379
StatusCode: http.StatusOK,
380380
Status: http.StatusText(http.StatusOK),
381-
Body: io.NopCloser(bytes.NewReader((testutil.GenJSON(entry)))),
381+
Body: io.NopCloser(bytes.NewReader(testutil.GenJSON(entry))),
382382
},
383383
},
384384
},

‎pkg/commands/dashboard/item/delete.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ func (c *DeleteCommand) Exec(_ io.Reader, out io.Writer) error {
8080
}
8181

8282
if success {
83-
text.Success(out, `Removed %d dashboard item(s) from Custom Dashboard "%s" (dashboardID: %s)`, (numItems - (len(d.Items))), d.Name, d.ID)
83+
text.Success(out, `Removed %d dashboard item(s) from Custom Dashboard "%s" (dashboardID: %s)`, (numItems - len(d.Items)), d.Name, d.ID)
8484
} else {
8585
text.Warning(out, "dashboard (%s) has no item with ID (%s)", d.ID, c.itemID)
8686
}

‎pkg/commands/ip/ip_test.go‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ func TestAllIPs(t *testing.T) {
1818
API: &mock.API{
1919
AllIPsFn: func(_ context.Context) (v4, v6 fastly.IPAddrs, err error) {
2020
return []string{
21-
"00.123.45.6/78",
22-
}, []string{
23-
"0a12:3b45::/67",
24-
}, nil
21+
"00.123.45.6/78",
22+
}, []string{
23+
"0a12:3b45::/67",
24+
}, nil
2525
},
2626
},
2727
WantOutput: "\nIPv4\n\t00.123.45.6/78\n\nIPv6\n\t0a12:3b45::/67\n",

‎pkg/commands/ngwaf/customsignal/customsignal_test.go‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ func TestCustomSignalCreate(t *testing.T) {
6161
Response: &http.Response{
6262
StatusCode: http.StatusOK,
6363
Status: http.StatusText(http.StatusOK),
64-
Body: io.NopCloser(bytes.NewReader((testutil.GenJSON(customSignal)))),
64+
Body: io.NopCloser(bytes.NewReader(testutil.GenJSON(customSignal))),
6565
},
6666
},
6767
},
@@ -177,7 +177,7 @@ func TestCustomSignalGet(t *testing.T) {
177177
Response: &http.Response{
178178
StatusCode: http.StatusOK,
179179
Status: http.StatusText(http.StatusOK),
180-
Body: io.NopCloser(bytes.NewReader((testutil.GenJSON(customSignal)))),
180+
Body: io.NopCloser(bytes.NewReader(testutil.GenJSON(customSignal))),
181181
},
182182
},
183183
},
@@ -191,7 +191,7 @@ func TestCustomSignalGet(t *testing.T) {
191191
Response: &http.Response{
192192
StatusCode: http.StatusOK,
193193
Status: http.StatusText(http.StatusOK),
194-
Body: io.NopCloser(bytes.NewReader((testutil.GenJSON(customSignal)))),
194+
Body: io.NopCloser(bytes.NewReader(testutil.GenJSON(customSignal))),
195195
},
196196
},
197197
},

‎pkg/commands/ngwaf/iplist/iplist_test.go‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ func TestIPListCreate(t *testing.T) {
8383
Response: &http.Response{
8484
StatusCode: http.StatusOK,
8585
Status: http.StatusText(http.StatusOK),
86-
Body: io.NopCloser(bytes.NewReader((testutil.GenJSON(stringlist)))),
86+
Body: io.NopCloser(bytes.NewReader(testutil.GenJSON(stringlist))),
8787
},
8888
},
8989
},
@@ -199,7 +199,7 @@ func TestIPListGet(t *testing.T) {
199199
Response: &http.Response{
200200
StatusCode: http.StatusOK,
201201
Status: http.StatusText(http.StatusOK),
202-
Body: io.NopCloser(bytes.NewReader((testutil.GenJSON(stringlist)))),
202+
Body: io.NopCloser(bytes.NewReader(testutil.GenJSON(stringlist))),
203203
},
204204
},
205205
},
@@ -213,7 +213,7 @@ func TestIPListGet(t *testing.T) {
213213
Response: &http.Response{
214214
StatusCode: http.StatusOK,
215215
Status: http.StatusText(http.StatusOK),
216-
Body: io.NopCloser(bytes.NewReader((testutil.GenJSON(stringlist)))),
216+
Body: io.NopCloser(bytes.NewReader(testutil.GenJSON(stringlist))),
217217
},
218218
},
219219
},

‎pkg/commands/ngwaf/rule/rule_test.go‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ func TestRuleCreate(t *testing.T) {
8989
Response: &http.Response{
9090
StatusCode: http.StatusOK,
9191
Status: http.StatusText(http.StatusOK),
92-
Body: io.NopCloser(bytes.NewReader((testutil.GenJSON(rule)))),
92+
Body: io.NopCloser(bytes.NewReader(testutil.GenJSON(rule))),
9393
},
9494
},
9595
},
@@ -103,7 +103,7 @@ func TestRuleCreate(t *testing.T) {
103103
Response: &http.Response{
104104
StatusCode: http.StatusOK,
105105
Status: http.StatusText(http.StatusOK),
106-
Body: io.NopCloser(bytes.NewReader((testutil.GenJSON(complexRule)))),
106+
Body: io.NopCloser(bytes.NewReader(testutil.GenJSON(complexRule))),
107107
},
108108
},
109109
},
@@ -219,7 +219,7 @@ func TestRuleGet(t *testing.T) {
219219
Response: &http.Response{
220220
StatusCode: http.StatusOK,
221221
Status: http.StatusText(http.StatusOK),
222-
Body: io.NopCloser(bytes.NewReader((testutil.GenJSON(rule)))),
222+
Body: io.NopCloser(bytes.NewReader(testutil.GenJSON(rule))),
223223
},
224224
},
225225
},
@@ -233,7 +233,7 @@ func TestRuleGet(t *testing.T) {
233233
Response: &http.Response{
234234
StatusCode: http.StatusOK,
235235
Status: http.StatusText(http.StatusOK),
236-
Body: io.NopCloser(bytes.NewReader((testutil.GenJSON(rule)))),
236+
Body: io.NopCloser(bytes.NewReader(testutil.GenJSON(rule))),
237237
},
238238
},
239239
},

‎pkg/commands/ngwaf/signallist/signallist_test.go‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ func TestSignalListCreate(t *testing.T) {
8383
Response: &http.Response{
8484
StatusCode: http.StatusOK,
8585
Status: http.StatusText(http.StatusOK),
86-
Body: io.NopCloser(bytes.NewReader((testutil.GenJSON(stringlist)))),
86+
Body: io.NopCloser(bytes.NewReader(testutil.GenJSON(stringlist))),
8787
},
8888
},
8989
},
@@ -199,7 +199,7 @@ func TestSignalListGet(t *testing.T) {
199199
Response: &http.Response{
200200
StatusCode: http.StatusOK,
201201
Status: http.StatusText(http.StatusOK),
202-
Body: io.NopCloser(bytes.NewReader((testutil.GenJSON(stringlist)))),
202+
Body: io.NopCloser(bytes.NewReader(testutil.GenJSON(stringlist))),
203203
},
204204
},
205205
},
@@ -213,7 +213,7 @@ func TestSignalListGet(t *testing.T) {
213213
Response: &http.Response{
214214
StatusCode: http.StatusOK,
215215
Status: http.StatusText(http.StatusOK),
216-
Body: io.NopCloser(bytes.NewReader((testutil.GenJSON(stringlist)))),
216+
Body: io.NopCloser(bytes.NewReader(testutil.GenJSON(stringlist))),
217217
},
218218
},
219219
},

0 commit comments

Comments
 (0)