-
Notifications
You must be signed in to change notification settings - Fork 201
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add generic ptr.To, ptr.Deref, ptr.Equal #283
Conversation
Welcome @skitt! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This simplifies the implementation and adds support for pointers to enums and arbitrary types. To allow a complete migration from pointer to ptr, this also moves AllPtrFieldsNil. The ptr.AllPtrFieldsNil "ptr" repetition is preserved since the function only looks at pointer fields. Existing deprecation notices are updated to point to the new functions, and the pointer package as a whole is deprecated. Existing test code is preserved as-is to "prove" the correctness of the migration. This was mostly written by Aldo Culquicondor; see kubernetes#269 for context. Signed-off-by: Stephen Kitt <skitt@redhat.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
/hold |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
/lgtm
/approve
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: alculquicondor, skitt, thockin The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/hold cancel The last 1.24 patch was released. |
@skitt could you mind I also work on "ptr.Deref" followed this PR ? any question please let me know, thanks. |
Please, go ahead! I’ve pushed all my pending changes, and I haven’t addressed |
@skitt I'd like to work on "ptr.Equal" |
The new k8s.io/utils/ptr package provides generic wrapper functions, which can be used instead of type-specific pointer wrapper functions. This replaces the latter with the former, and migrates other uses of the deprecated pointer package to ptr in affacted files. See kubernetes/utils#283 for details. Signed-off-by: Lan Liang <gcslyp@gmail.com>
The new k8s.io/utils/ptr package provides generic wrapper functions, which can be used instead of type-specific pointer wrapper functions. This replaces the latter with the former, and migrates other uses of the deprecated pointer package to ptr in affacted files. See kubernetes/utils#283 for details. Signed-off-by: Lan Liang <gcslyp@gmail.com>
The new k8s.io/utils/ptr package provides generic wrapper functions, which can be used instead of type-specific pointer wrapper functions. This replaces the latter with the former, and migrates other uses of the deprecated pointer package to ptr in affacted files. See kubernetes/utils#283 for details. Signed-off-by: Lan Liang <gcslyp@gmail.com>
The new k8s.io/utils/ptr package provides generic wrapper functions, which can be used instead of type-specific pointer wrapper functions. This replaces the latter with the former, and migrates other uses of the deprecated pointer package to ptr in affacted files. See kubernetes/utils#283 for details. Signed-off-by: Lan Liang <gcslyp@gmail.com>
The new k8s.io/utils/ptr package provides generic wrapper functions, which can be used instead of type-specific pointer wrapper functions. This replaces the latter with the former, and migrates other uses of the deprecated pointer package to ptr in affacted files. See kubernetes/utils#283 for details. Signed-off-by: Lan Liang <gcslyp@gmail.com>
The new k8s.io/utils/ptr package provides generic wrapper functions, which can be used instead of type-specific pointer wrapper functions. This replaces the latter with the former, and migrates other uses of the deprecated pointer package to ptr in affacted files. See kubernetes/utils#283 for details. Signed-off-by: Lan Liang <gcslyp@gmail.com>
The new k8s.io/utils/ptr package provides generic wrapper functions, which can be used instead of type-specific pointer wrapper functions. This replaces the latter with the former, and migrates other uses of the deprecated pointer package to ptr in affacted files. See kubernetes/utils#283 for details. Signed-off-by: Lan Liang <gcslyp@gmail.com>
The new k8s.io/utils/ptr package provides generic wrapper functions, which can be used instead of type-specific pointer wrapper functions. This replaces the latter with the former, and migrates other uses of the deprecated pointer package to ptr in affacted files. See kubernetes/utils#283 for details. Signed-off-by: Lan Liang <gcslyp@gmail.com>
The new k8s.io/utils/ptr package provides generic wrapper functions, which can be used instead of type-specific pointer wrapper functions. This replaces the latter with the former, and migrates other uses of the deprecated pointer package to ptr in affacted files. See kubernetes/utils#283 for details. Signed-off-by: Lan Liang <gcslyp@gmail.com>
…nce a pointer. The new k8s.io/utils/ptr package provides generic wrapper functions, which can be used instead of type-specific pointer wrapper functions. This replaces the latter with the former, and migrates other uses of the deprecated pointer package to ptr in affacted files. See kubernetes/utils#283 for details. Signed-off-by: Lan Liang <gcslyp@gmail.com>
…nce a pointer. The new k8s.io/utils/ptr package provides generic wrapper functions, which can be used instead of type-specific pointer wrapper functions. This replaces the latter with the former, and migrates other uses of the deprecated pointer package to ptr in affacted files. See kubernetes/utils#283 for details. Signed-off-by: Lan Liang <gcslyp@gmail.com> Signed-off-by: 08AHAD <91091911+08AHAD@users.noreply.github.com>
The new k8s.io/utils/ptr package provides generic wrapper functions, which can be used instead of type-specific pointer wrapper functions. This replaces the latter with the former, and migrates other uses of the deprecated pointer package to ptr in affacted files. See kubernetes/utils#283 for details. Signed-off-by: Lan Liang <gcslyp@gmail.com>
What type of PR is this?
/kind feature
What this PR does / why we need it:
This adds a
ptr
package containing generic equivalents of thepointer
functions:ptr.To
,ptr.Deref
andptr.Equal
. This simplifies the implementation and adds support for pointers to enums and arbitrary types.To allow a complete migration from
pointer
toptr
, this also movesAllPtrFieldsNil
. Theptr.AllPtrFieldsNil
"ptr" repetition is preserved since the function only looks at pointer fields.Existing deprecation notices are updated to point to the new functions, and the pointer package as a whole is deprecated. Existing test code is preserved as-is to "prove" the correctness of the migration.
This was mostly written by @alculquicondor ; see #269 for context.
Which issue(s) this PR fixes:
Special notes for your reviewer:
Release note: