Dismiss gosec G602 and G115 in test code (#40960)

<!-- Add the related story/sub-task/bug number, like Resolves #123, or
remove if NA -->
**Related issue:** Resolves #
Dismisses some gosec rules in test code where they do not apply, since
they show up when running `golangci-lint run` locally and make it harder
to spot newly introduced errors.

# Checklist for submitter

## Testing

- [x] Added/updated automated tests
- [ ] Where appropriate, [automated tests simulate multiple hosts and
test for host
isolation](https://github.com/fleetdm/fleet/blob/main/docs/Contributing/reference/patterns-backend.md#unit-testing)
(updates to one hosts's records do not affect another)

- [ ] QA'd all new/changed functionality manually
This commit is contained in:
Jonathan Katz
2026-03-04 13:34:35 -05:00
committed by GitHub
parent 7d4acdc5c4
commit f260fbf85a
10 changed files with 18 additions and 18 deletions
+2 -2
View File
@@ -72,7 +72,7 @@ func TestJiraFailer(t *testing.T) {
var failedIndices []int
cves := []string{"CVE-2018-1234", "CVE-2019-1234", "CVE-2020-1234", "CVE-2021-1234"}
for i := 0; i < 10; i++ {
cve := cves[i%len(cves)]
cve := cves[i%len(cves)] //nolint:gosec // dismiss G602
err := jira.Run(license.NewContext(context.Background(), &fleet.LicenseInfo{Tier: fleet.TierFree}), json.RawMessage(fmt.Sprintf(`{"vulnerability":{"cve":%q}}`, cve)))
if err != nil {
failedIndices = append(failedIndices, i)
@@ -131,7 +131,7 @@ func TestZendeskFailer(t *testing.T) {
var failedIndices []int
cves := []string{"CVE-2018-1234", "CVE-2019-1234", "CVE-2020-1234", "CVE-2021-1234"}
for i := 0; i < 10; i++ {
cve := cves[i%len(cves)]
cve := cves[i%len(cves)] //nolint:gosec // dismiss G602
err := zendesk.Run(license.NewContext(context.Background(), &fleet.LicenseInfo{Tier: fleet.TierFree}), json.RawMessage(fmt.Sprintf(`{"vulnerability":{"cve":%q}}`, cve)))
if err != nil {
failedIndices = append(failedIndices, i)