Skip to content

ROX-35007: enable modernize linter with all checks disabled#21063

Draft
janisz wants to merge 26 commits into
wip_bump_to_go_1.26from
ROX-35007-enable-modernize-linter
Draft

ROX-35007: enable modernize linter with all checks disabled#21063
janisz wants to merge 26 commits into
wip_bump_to_go_1.26from
ROX-35007-enable-modernize-linter

Conversation

@janisz

@janisz janisz commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Description

change me!

User-facing documentation

Testing and quality

  • the change is production ready: the change is GA, or otherwise the functionality is gated by a feature flag
  • CI results are inspected

Automated testing

  • added unit tests
  • added e2e tests
  • added regression tests
  • added compatibility tests
  • modified existing tests

How I validated my change

change me!
Enable the modernize linter in golangci-lint but keep all
sub-checks disabled as a baseline. Each check will be enabled
and auto-fixed in subsequent commits.

Partially generated by AI

Co-Authored-By: Claude Opus 4.6 noreply@anthropic.com

janisz and others added 26 commits June 10, 2026 12:00
Bumps Go from 1.26.1 to 1.26.2 to address critical compiler bugs
and security vulnerabilities fixed in the April 7, 2026 release:

- CVE-2026-33810: Compiler fails to unwrap pointers in no-op interface conversions
- CVE-2026-27144: Incorrect bounds checking for slices/arrays with induction variables
- CVE-2026-32282: html/template XSS vulnerability in JS template literals
- CVE-2026-27143: tar.Reader unbounded memory allocation

These compiler bugs in 1.26.1 were causing widespread test failures
in CI (unit tests, postgres tests, benchmarks). Go 1.26.2 includes
the necessary fixes for safe production use.

Related: ROX-34147
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

# Conflicts:
#	go.mod
Updates Go version in all tool modules to match the main go.mod:
- tools/build/go.mod: 1.25.0 → 1.26.2
- tools/check-workflow-run/go.mod: 1.25 → 1.26.2
- tools/linters/go.mod: 1.25.0 → 1.26.2
- tools/proto/go.mod: 1.25.7 → 1.26.2
- tools/test/go.mod: 1.25 → 1.26.2

This fixes the golangci-lint CI failure where golangci-lint was built
with Go 1.25.0 but tried to lint code targeting Go 1.26.

Error was:
  can't load config: the Go language version (go1.25) used to build
  golangci-lint is lower than the targeted Go version (1.26)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Fixes govet printf errors caught by Go 1.26.2:
- pkg/env/integersetting.go: Use %v instead of %q for []int slice
- pkg/grpc/testutils.go: Add ... when forwarding variadic args

Disables modernize linter (373 instances):
- The modernize linter suggests using Go 1.26's new(expr) syntax
- This is a large change (373 files) better suited for a separate PR
- TODO ROX-34147: Re-enable in follow-up PR for code modernization

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Go 1.26.2's url.Parse() requires IPv6 addresses to be bracketed, but the
codebase expects to support unbracketed IPv6 including the ambiguous
"IPv6:port" format (e.g., "2001:...:8329:61273") per RFC2732 interpretation.

Updated addrValid() to:
- Explicitly check for illegal whitespace characters
- Use netutil.ParseEndpoint() for IPv6 addresses (handles all formats)
- Use url.Parse() for regular hostnames (strict validation)

Fixes all Test_addrValid failures for IPv6 addresses while maintaining
strict validation for regular hostnames with spaces or illegal characters.

User request: Look at current failures and plan how to fix them.
AI-assisted code change.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Go 1.26.2 may have subtle goroutine scheduling changes that expose timing
assumptions in TestPruning. Increased timeout from 3*prunePeriod (300ms)
to 5*prunePeriod (500ms) to provide more buffer for ticker timing.

The pruning functionality works correctly (logs show "successfully pruned
1 out of 1 indicators"), but the WaitWithTimeout was failing due to race
condition between prunedSignal.Reset() and ticker firing.

User request: Look at current failures and plan how to fix them.
AI-assisted code change.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Documents the complete process for upgrading Go versions in the StackRox
project, including:
- Files to update (go.mod, workflows, tool modules)
- Expected test failures and how to fix them
- CI infrastructure considerations (setup-go action, cache invalidation)
- Konflux builder requirements
- Common issues and solutions

This guide captures lessons learned from the Go 1.26.2 upgrade, particularly
the need for setup-go action when container has older Go version and the
Konflux go-builder dependency.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Refactored the guide to be general documentation about Go upgrades
rather than specific to 1.26.2:

- Removed hardcoded version numbers, replaced with placeholders
- Organized around principles and patterns rather than specific steps
- Added comprehensive sections on:
  - Understanding test failure categories
  - CI infrastructure challenges and solutions
  - External build system dependencies
  - Best practices and security considerations
- Expanded troubleshooting with root cause explanations
- Made it clear what's StackRox-specific vs general Go concepts

The guide now serves as evergreen documentation that applies to
any future Go upgrade, with lessons learned from past upgrades
informing the approach.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Go 1.26.2 changed the URL parser to validate port syntax before checking
URL escapes. Updated error message expectation to match new behavior.

Fixes WebSocket test failures in:
- TestAuthenticatedHTTPTransport_WebSocket/invalid_wss
- TestAuthenticatedHTTPTransport_WebSocket/invalid_ws

Partially AI-generated
Go 1.26.3 is the latest patch release with the compiler and
security fixes we need. The brew builder image (buildID 4026077)
ships Go 1.26.3.

Partially generated by AI

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Align all tools/*/go.mod with the main module Go version.

Partially generated by AI

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Update openshift-golang-builder from rhel_9_golang_1.25 to
rhel_9_golang_1.26 (brew buildID 4026077, Go 1.26.3).

Partially generated by AI

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Align all operator/tools/*/go.mod with the target Go version.

Partially generated by AI

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Was at go 1.24 with a stale toolchain directive.

Partially generated by AI

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The guide duplicates information that belongs in commit messages
and PR descriptions rather than a standalone document.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Enable the modernize linter in golangci-lint but keep all
sub-checks disabled as a baseline. Each check will be enabled
and auto-fixed in subsequent commits.

Partially generated by AI

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…x,stringsseq,waitgroup and auto-fix

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@openshift-ci

openshift-ci Bot commented Jun 10, 2026

Copy link
Copy Markdown

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@coderabbitai

coderabbitai Bot commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Enterprise

Run ID: 7a497a24-2bd0-4c77-b67a-49a203b70c00

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
  • Commit unit tests in branch ROX-35007-enable-modernize-linter

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

@openshift-ci

openshift-ci Bot commented Jun 10, 2026

Copy link
Copy Markdown

PR needs rebase.

Details

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.

@janisz janisz force-pushed the wip_bump_to_go_1.26 branch from dd11060 to 02cce8b Compare June 10, 2026 16:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant