🌱 Adopt new(x) over ptr.To(x) and re-enable newexpr lint#3489
🌱 Adopt new(x) over ptr.To(x) and re-enable newexpr lint#3489k8s-ci-robot merged 1 commit intokubernetes-sigs:mainfrom
Conversation
Replace all ptr.To(x) calls with the Go 1.26 built-in new(x), remove the newexpr suppression from .golangci.yml, and drop unused k8s.io/utils/ptr imports. Also fix two pre-existing modernize lint issues (stringsbuilder, atomic). Signed-off-by: Kunal Memane <kmemane@redhat.com>
|
Hi @kunalmemane. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Regular contributors should join the org to skip this step. Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. 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. |
|
/ok-to-test |
|
LGTM label has been added. DetailsGit tree hash: 7f1f67ce3ab3dc1125e20f772491598fbcfee4e1 |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: alvaroaleman, kunalmemane The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
With Go 1.26, the built-in
new(x)can take a value expression and return a pointer to it, makingptr.To(x)fromk8s.io/utils/ptrredundant. Thenewexpr modernizerule was temporarily disabled in.golangci.ymlto unblock thev0.36.0-beta.0dependency bump.This commit completes the follow-up work : #3488
ptr.To(x)withnew(x)across the codebase, including type-parameterized variants likeptr.To[int64](x)which becomenew(int64(x))k8s.io/utils/ptrimport from 29 files that no longer use itdesigns/warmreplicas.mdand godoc comments(stringsbuilder, atomic)to keepgolangci-lintfully clean