Skip to content

SREP-4482: Update golangci-lint configuration with enhanced linters#716

Merged
openshift-merge-bot[bot] merged 1 commit into
openshift:masterfrom
devppratik:srep-4482-update-golang-ci
May 5, 2026
Merged

SREP-4482: Update golangci-lint configuration with enhanced linters#716
openshift-merge-bot[bot] merged 1 commit into
openshift:masterfrom
devppratik:srep-4482-update-golang-ci

Conversation

@devppratik

@devppratik devppratik commented Apr 22, 2026

Copy link
Copy Markdown
Contributor

Based on the agreed golden standard for golangci.yml which can be used by all the agents & developers, enhance the golangci-lint configuration to include a more comprehensive set of linters organized by priority (Critical, High, Medium, Optional) with appropriate settings for error handling, security, and code quality checks.

Related to SREP-4482

Enhance the golangci-lint configuration to include a more comprehensive set
of linters organized by priority (Critical, High, Medium, Optional) with
appropriate settings for error handling, security, and code quality checks.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Apr 22, 2026
@openshift-ci-robot

openshift-ci-robot commented Apr 22, 2026

Copy link
Copy Markdown

@devppratik: This pull request references SREP-4482 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "5.0.0" version, but no target version was set.

Details

In response to this:

Based on the agreed golden standard for golangci.yml which can be used by all the agents & developers, enhance the golangci-lint configuration to include a more comprehensive set of linters organized by priority (Critical, High, Medium, Optional) with appropriate settings for error handling, security, and code quality checks.

Related to SREP-4482

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@coderabbitai

coderabbitai Bot commented Apr 22, 2026

Copy link
Copy Markdown

Important

Review skipped

Review was skipped due to path filters

⛔ Files ignored due to path filters (1)
  • boilerplate/openshift/golang-osd-operator/golangci.yml is excluded by !boilerplate/**

CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including **/dist/** will override the default block on the dist directory, by removing the pattern from both the lists.

⚙️ Run configuration

Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: eb200afa-123e-42e1-a794-0da9cae13ce7

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@devppratik

Copy link
Copy Markdown
Contributor Author

/label do-not-merge

@openshift-ci

openshift-ci Bot commented Apr 22, 2026

Copy link
Copy Markdown
Contributor

@devppratik: The label(s) /label do-not-merge cannot be applied. These labels are supported: acknowledge-critical-fixes-only, platform/aws, platform/azure, platform/baremetal, platform/google, platform/libvirt, platform/openstack, ga, tide/merge-method-merge, tide/merge-method-rebase, tide/merge-method-squash, px-approved, docs-approved, qe-approved, ux-approved, no-qe, rebase/manual, cluster-config-api-changed, run-integration-tests, verified, approved, backport-risk-assessed, bugzilla/valid-bug, cherry-pick-approved, jira/skip-dependent-bug-check, jira/valid-bug, ok-to-test, stability-fix-approved, staff-eng-approved. Is this label configured under labels -> additional_labels or labels -> restricted_labels in plugin.yaml?

Details

In response to this:

/label do-not-merge

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@devppratik

Copy link
Copy Markdown
Contributor Author

/label do-not-merge/hold

@openshift-ci

openshift-ci Bot commented Apr 22, 2026

Copy link
Copy Markdown
Contributor

@devppratik: The label(s) /label do-not-merge/hold cannot be applied. These labels are supported: acknowledge-critical-fixes-only, platform/aws, platform/azure, platform/baremetal, platform/google, platform/libvirt, platform/openstack, ga, tide/merge-method-merge, tide/merge-method-rebase, tide/merge-method-squash, px-approved, docs-approved, qe-approved, ux-approved, no-qe, rebase/manual, cluster-config-api-changed, run-integration-tests, verified, approved, backport-risk-assessed, bugzilla/valid-bug, cherry-pick-approved, jira/skip-dependent-bug-check, jira/valid-bug, ok-to-test, stability-fix-approved, staff-eng-approved. Is this label configured under labels -> additional_labels or labels -> restricted_labels in plugin.yaml?

Details

In response to this:

/label do-not-merge/hold

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@devppratik

Copy link
Copy Markdown
Contributor Author

/hold

@openshift-ci openshift-ci Bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Apr 22, 2026
- examples/

run:
timeout: 5m

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the motivation for removing the concurrency and setting a 5m timeout?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From https://golangci-lint.run/docs/configuration/file/#run-configuration
In golangci-lint v2, the default concurrency is 0, which automatically matches the Linux container CPU quota and falls back to the number of logical CPUs. Removing the explicit concurrency: 10 setting allows golangci-lint to auto-tune based on available resources, which is the recommended approach.

I have added the timeout setting to prevents indefinite run. It seemed to work without any issues in the local. Can adjust as needed

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gotcha, so this is a global config meaning each operator will use it. If we run into a project taking too long, we will need to tune this timeout.

Can you test this config on some other projects, like osdctl etc to just get a bit more data to prove the 5m is enough? I have seen timeouts in CI for linting due to resource pressure in the CI clusters.

@geowa4 geowa4 Apr 30, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While I personally prefer having the CI or surrounding framework (like prek or pre-commit) handle the per-task timeout, 5 minutes seems like a reasonable starting point to build off of, and testing on others like osdctl seems like a reasonable request to get a multi-project baseline.

Other thought: we should fail builds if this times out so we can get that feedback and make the correction.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@joshbranham Yes, this is more of a global config that we add. We can look. to have this fine tune later per project if required. I did check with osdctl locally and it seems to be running without issues.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ran this on a couple other projects and measured time in seconds so 5m should have plenty of buffer. LGTM

@devppratik devppratik changed the title [Draft] SREP-4482: Update golangci-lint configuration with enhanced linters SREP-4482: Update golangci-lint configuration with enhanced linters Apr 29, 2026
@krishvoor

Copy link
Copy Markdown
Member

/unhold

@openshift-ci openshift-ci Bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label May 4, 2026
@devppratik

Copy link
Copy Markdown
Contributor Author

/hold Putting on hold until APAC Time to merge and update operators

@openshift-ci openshift-ci Bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label May 4, 2026
@bmeng

bmeng commented May 5, 2026

Copy link
Copy Markdown
Contributor

/lgtm

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label May 5, 2026
@openshift-ci

openshift-ci Bot commented May 5, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: bmeng, devppratik

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

@openshift-ci openshift-ci Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 5, 2026
@krishvoor

Copy link
Copy Markdown
Member

/unhold

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. lgtm Indicates that a PR is ready to be merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants