ci(golangci): roll out goconst conservatively - #4976
Conversation
|
Skipping CI for Draft Pull Request. |
5d1fe63 to
6e24c15
Compare
There was a problem hiding this comment.
Pull request overview
This PR rolls out the goconst linter in ARO-RP with conservative thresholds to reduce rollout noise, adds targeted exclusions for generated/generated-like code, and applies a small set of in-scope duplicate-string cleanups (primarily via shared constants) to reach a clean baseline.
Changes:
- Enable
goconstin.golangci.ymlwith conservative settings and add path-based exclusions to avoid churn in generated/generated-like code. - Replace repeated ARM template schema/resourceId strings with shared constants in
pkg/clusterandpkg/deploy/generator. - Add an agent-guide note documenting the measured
goconstthreshold sweep and chosen settings.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/monitor/cluster/clusteroperatorconditions.go | Deduplicates a repeated operator name string using a const to satisfy goconst. |
| pkg/deploy/generator/templates_dev.go | Reuses a shared devVPNVnet resourceId constant to reduce duplicate strings. |
| pkg/deploy/generator/resources_dev.go | Introduces devVPNVnetResourceID constant to dedupe ARM resourceId(...) usage. |
| pkg/cluster/workloadidentityresources.go | Switches ARM template schema string to a shared constant. |
| pkg/cluster/template.go | Adds shared deploymentTemplateSchema constant for the cluster package. |
| pkg/cluster/storageaccounts.go | Switches ARM template schema string to a shared constant. |
| pkg/cluster/gatewayprivateendpoint.go | Switches ARM template schema string to a shared constant. |
| pkg/cluster/deploybaseresources.go | Switches ARM template schema string to a shared constant. |
| pkg/cluster/denyassignment.go | Switches ARM template schema string to a shared constant. |
| pkg/cluster/clusterserviceprincipal.go | Switches ARM template schema string to a shared constant. |
| docs/agent-guides/goconst-rollout-note.md | Documents the conservative goconst rollout and chosen thresholds/exclusions. |
| .golangci.yml | Enables/configures goconst and adds explicit exclusions for generated/generated-like paths. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| This note records the conservative `goconst` rollout for PR2. | ||
|
|
||
| ## Measured Findings | ||
|
|
||
| The counts below were measured from the PR2 worktree with the planned generated/generated-like exclusions in place: |
|
|
||
| Why this threshold: | ||
|
|
||
| - `20/4` and `24/4` still produced a broader cross-package cleanup than PR2 should carry. |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 12 out of 12 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (2)
docs/agent-guides/goconst-rollout-note.md:7
- This doc refers to "PR2", which is ambiguous and will quickly become outdated. Consider phrasing it relative to the current change (e.g., "this PR") or using a concrete PR number.
This note records the conservative `goconst` rollout for PR2.
## Measured Findings
The counts below were measured from the PR2 worktree with the planned generated/generated-like exclusions in place:
docs/agent-guides/goconst-rollout-note.md:27
- This bullet uses "PR2" as a moving reference. Rewording to "this PR" (or a concrete PR number) will keep the note accurate over time.
- `20/4` and `24/4` still produced a broader cross-package cleanup than PR2 should carry.
34b74fc to
2b95bf9
Compare
Summary
goconstconservatively in.golangci.ymldocs/agent-guides/multi-module-build.mdRelated
Validation
make lint-gomake unit-test-go(fails in existing baseline tests unrelated to this diff)pkg/frontend/adminactionsTestTopPodsTable/Client_Initialization_Failurepkg/frontend/adminactionsTestTopNodesTable/Client_Initialization_Failurego test -v ./pkg/frontend/adminactions -run 'TestTop(Pods|Nodes)Table'on cleanmasterreproduces the same failuresJira
ARO-28459