Skip to content

Enable gosec/golangci-lint, then fix reported errors #927

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jgwest
Copy link
Collaborator

@jgwest jgwest commented Jul 23, 2025

What type of PR is this?

Uncomment only one /kind line, and delete the rest.
For example, > /kind bug would simply become: /kind bug

/kind cleanup

What does this PR do / why we need it:

  • Add gosec and golangci-lint targets to Makefile

  • Add call to gosec and golangci-lint (with default settings) to GitHub workflow

  • Adds ginkgo-linter, which ensures that Ginkgo code is properly formatted (we used this on managed-gitops project, and it was created by a Red Hatter who reached out to let us know about it, previously)

  • The rest of the PR is cleaning up issues identified by gosec and golangci-lint

  • You'll occasionally see cases where I've had to 'smother' a line with lint ignores, like so:

	//lint:ignore SA1019 known to be deprecated
	assert.DeepEqual(t, testArgoCD.Spec.Grafana.Resources, testGrafanaResources) //nolint:staticcheck // SA1019: We must test deprecated fields.
  • Unfortunately this is necessary to add ignores for BOTH VS Code warnings AND golangci-lint errors

@openshift-ci openshift-ci bot added the kind/cleanup Categorizes issue or PR as related to cleaning up code, process. label Jul 23, 2025
@openshift-ci openshift-ci bot requested review from trdoyle81 and varshab1210 July 23, 2025 14:28
Copy link

openshift-ci bot commented Jul 23, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign jgwest for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@jgwest jgwest force-pushed the add-gosec-and-golangci-lint-july-2025 branch from c4beaf0 to e405f2b Compare July 23, 2025 14:48
@jgwest
Copy link
Collaborator Author

jgwest commented Jul 23, 2025

/retest

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/cleanup Categorizes issue or PR as related to cleaning up code, process.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant