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

Merged

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
@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

@jannfis
Copy link
Member

jannfis commented Jul 28, 2025

/lgtm

@jannfis
Copy link
Member

jannfis commented Jul 28, 2025

/approve

Copy link

openshift-ci bot commented Jul 28, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jannfis

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

The pull request process is described 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
Copy link
Collaborator Author

jgwest commented Jul 29, 2025

Thanks @jannfis!

Merging, as the Konflux workflow error appears unrelated to this PR:

✕ [Violation] slsa_source_correlated.expected_source_code_reference
  ImageRef: quay.io/redhat-user-workloads/rh-openshift-gitops-tenant/dex@sha256:11a13a97b4450b01934a7632692511d1fef1357af9cdbdfdf29f19854203ac6b
  Reason: The expected source code reference
  "git+https://github.com/rh-gitops-midstream/downstream-dex@149705e191549b57c62b0567a87f99406e96e6ae" is not attested

@jgwest jgwest merged commit 2f4984c into redhat-developer:master Jul 29, 2025
16 of 18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved kind/cleanup Categorizes issue or PR as related to cleaning up code, process. lgtm
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants