ROX-35007: enable modernize linter with all checks disabled#21063
ROX-35007: enable modernize linter with all checks disabled#21063janisz wants to merge 26 commits into
Conversation
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>
|
Skipping CI for Draft Pull Request. |
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Enterprise Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
PR needs rebase. DetailsInstructions 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. |
dd11060 to
02cce8b
Compare
Description
change me!
User-facing documentation
Testing and quality
Automated testing
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