ROX-35007: enable modernize/newexpr - #21189
Conversation
|
Skipping CI for Draft Pull Request. |
|
This change is part of the following stack:
Change managed by git-spice. |
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughSummary by CodeRabbit
WalkthroughThe pull request replaces shared pointer helper calls with Go’s built-in ChangesPointer allocation migration
Estimated code review effort: 3 (Moderate) | ~20 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Comment |
🚀 Build Images ReadyImages are ready for commit af61b61. To use with deploy scripts: export MAIN_IMAGE_TAG=4.12.x-656-gaf61b61351 |
f5028b2 to
0c0eb42
Compare
976a4fa to
300bb02
Compare
0c0eb42 to
cd2ebea
Compare
300bb02 to
347a815
Compare
cd2ebea to
9f5379a
Compare
347a815 to
555024a
Compare
9f5379a to
b92b69a
Compare
555024a to
87e73f2
Compare
b92b69a to
b8b1ce7
Compare
78fc490 to
10dea27
Compare
19e6ed4 to
eb8cc27
Compare
10dea27 to
bc199a8
Compare
eb8cc27 to
138870e
Compare
bc199a8 to
61c23d4
Compare
759b6ec to
075e1b8
Compare
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@central/graphql/resolvers/image_vulnerabilities_benchmark_test.go`:
- Line 57: Update the Limit initialization in the benchmark test to use a typed
int32 value, such as a local int32 variable initialized to 20000 and passed by
address, or new(int32) with assignment; do not call new with the numeric
literal.
In `@central/graphql/resolvers/search_test.go`:
- Line 195: Update every test occurrence of Pagination.Limit using new(10) to
use new(int32(10)), ensuring the pointer type matches the field’s expected
*int32 type.
In `@tests/redhat_signing_key_test.go`:
- Around line 373-374: Update the DeploymentSpec.Replicas assignment in the test
to use an int32 value and pass its address, replacing new(1) with a
*int32-compatible expression.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Central YAML (base), Organization UI (inherited)
Review profile: CHILL
Plan: Enterprise
Run ID: dd1ea72d-d1b5-484c-9ce3-5763288f5903
📒 Files selected for processing (66)
.golangci.ymlcentral/backgroundmigrations/runner/rollout_test.gocentral/baseimage/datastore/repository/datastore_impl_test.gocentral/baseimage/service/service_impl.gocentral/baseimage/service/service_impl_test.gocentral/complianceoperator/v2/integration/datastore/datastore_impl_test.gocentral/complianceoperator/v2/integration/service/convert_test.gocentral/complianceoperator/v2/integration/service/service_impl_test.gocentral/detection/alertmanager/alert_manager_impl_test.gocentral/graphql/resolvers/deployments_test.gocentral/graphql/resolvers/image_cve_core.gocentral/graphql/resolvers/image_cve_core_test.gocentral/graphql/resolvers/image_cve_v2_core_test.gocentral/graphql/resolvers/image_vulnerabilities_benchmark_test.gocentral/graphql/resolvers/image_vulnerabilities_v2_test.gocentral/graphql/resolvers/images_test.gocentral/graphql/resolvers/inputtypes/vuln_req_test.gocentral/graphql/resolvers/node_cve_core.gocentral/graphql/resolvers/node_cve_core_test.gocentral/graphql/resolvers/platform_cve_core_test.gocentral/graphql/resolvers/search_test.gocentral/graphql/resolvers/utils.gocentral/sensor/service/connection/upgradecontroller/stateutils/all_transitions.gocentral/views/imagecve/view_test.gocentral/views/imagecveflat/view_test.gocompliance/collection/kubernetes/kubelet.gomigrator/migrations/policymigrationhelper/policy_migrator.gomigrator/migrations/policymigrationhelper/postgres_policy_migrator_test.gooperator/api/v1alpha1/central_defaults_test.gooperator/api/v1alpha1/common_types_test.gooperator/internal/central/defaults/central_db.gooperator/internal/central/defaults/central_db_test.gooperator/internal/central/defaults/static.gooperator/internal/central/extensions/reconcile_central_db_password_test.gooperator/internal/central/extensions/reconcile_pvc_test.gooperator/internal/central/values/translation/translation_test.gooperator/internal/common/status/predicate_test.gooperator/internal/securedcluster/defaults/admission_controller.gooperator/internal/securedcluster/defaults/static.gooperator/internal/securedcluster/extensions/reconcile_defaulting_test.gooperator/internal/securedcluster/values/translation/translation_test.gooperator/internal/tlsprofile/convert_test.gooperator/internal/values/translation/translation_test.gopkg/booleanpolicy/evaluator/evaluator_test.gopkg/cluster/filtering.gopkg/cluster/filtering_test.gopkg/migratetooperator/central.gopkg/migratetooperator/securedcluster.gopkg/pointers/pointer.gopkg/protoconv/resources/resources_test.gopkg/search/postgres/common.gopkg/search/postgres/query_metadata.goroxctl/central/central.goroxctl/common/flags/endpoint_test.goroxctl/netpol/generate/generate_test.goroxctl/sensor/generate/openshift.gosensor/common/clusterentities/store_ips_test.gosensor/kubernetes/complianceoperator/utils.gosensor/kubernetes/fake/deployment.gosensor/kubernetes/fake/virtualmachines_test.gosensor/kubernetes/listener/resources/virtualmachine/store/virtual_machine_store_test.gotests/common.gotests/init_container_test.gotests/ocp_dynamic_plugin_test.gotests/redhat_signing_key_test.gotools/retest/github.go
💤 Files with no reviewable changes (2)
- pkg/pointers/pointer.go
- .golangci.yml
a376ccd to
e698c20
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #21189 +/- ##
==========================================
- Coverage 51.26% 51.22% -0.05%
==========================================
Files 2869 2868 -1
Lines 179230 179222 -8
==========================================
- Hits 91883 91800 -83
- Misses 79289 79347 +58
- Partials 8058 8075 +17
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
267a40c to
b676194
Compare
Signed-off-by: Tomasz Janiszewski <tomek@redhat.com>
Enable modernize/newexpr linter rule and replace pointer helper functions with Go 1.26's new(value) syntax across 29 files. Replaces pointers.String/Bool/Int32/Int64/Float32/Pointer calls and deletes 6 now-unused local pointer helper functions. Partially generated by AI. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace ptr/ptr32 pointer helpers with new(value) and delete the now-unused functions. Missed in previous commit because these files were added to master after the branch diverged. Partially generated by AI. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Tomasz Janiszewski <tomek@redhat.com>
Signed-off-by: Tomasz Janiszewski <tomek@redhat.com>
vikin91
left a comment
There was a problem hiding this comment.
Checked by machinery: "No correctness issues found in the scoped PR changes."
Manually checked the pkg & sensor folders - no issues.
|
/retest |
2 similar comments
|
/retest |
|
/retest |
Description
Replace custom functions that returns a pointer to a value with
new. Sometimes it requires a cast e.g.new(int32(1))Refs:
User-facing documentation
Testing and quality
Automated testing
How I validated my change
CI