Skip to content

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

Merged
jgwest merged 1 commit into
redhat-developer:masterfrom
jgwest:add-gosec-and-golangci-lint-july-2025
Jul 29, 2025
Merged

Enable gosec/golangci-lint, then fix reported errors#927
jgwest merged 1 commit into
redhat-developer:masterfrom
jgwest:add-gosec-and-golangci-lint-july-2025

Conversation

@jgwest

@jgwest jgwest commented Jul 23, 2025

Copy link
Copy Markdown
Member

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
Signed-off-by: Jonathan West <jonwest@redhat.com>
@jgwest jgwest force-pushed the add-gosec-and-golangci-lint-july-2025 branch from c4beaf0 to e405f2b Compare July 23, 2025 14:48
@jgwest

jgwest commented Jul 23, 2025

Copy link
Copy Markdown
Member Author

/retest

@jannfis

jannfis commented Jul 28, 2025

Copy link
Copy Markdown
Member

/lgtm

@jannfis

jannfis commented Jul 28, 2025

Copy link
Copy Markdown
Member

/approve

@openshift-ci

openshift-ci Bot commented Jul 28, 2025

Copy link
Copy Markdown

[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

Details 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 commented Jul 29, 2025

Copy link
Copy Markdown
Member Author

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
Rizwana777 pushed a commit to Rizwana777/gitops-operator that referenced this pull request Aug 4, 2025
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