-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
⚠️ Functional Options Redux #536
⚠️ Functional Options Redux #536
Conversation
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: DirectXMan12 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 |
These behave more-or-less like functional options, except that a given option can be applied to more than on option type, so we can deprecate the 3 different dryrunall variants. Things with arguments generally become type aliases, with the exception of MatchingField, which gets deprecated in favor of MatchFields (a type alias to fields.Set).
For field manager, update and create also support fieldmanager, so we allow using them there. For dryrun, it's also supported by delete, so we support setting it there.
0216acb
to
320b6b6
Compare
Ooh, this is going to affect #341 :-) |
should be a relatively minor tweak though. lmk if you have any issues. |
No worries, I can rebase. |
📖 add how to get auth proxy for older project
This switches over our functional options to actually be interfaced-based. Practically, this feels incredibly similar for users, to the point where I expect nobody will have to change their code (with the exception of Preconditions, which was a pointer).
The upsides are slightly more ergonomic options in some cases (like
client.MatchingLabels{"foo": "bar"}
instead of needingclient.MatchingLabels(map[string]string{"foo": "bar"})
, although the latter still works), as well as the removal of the need for separate variants for options that apply across different operations.Technically, this is a breaking change, since there are type signature changes.
Fixes #503 (see that issue for more details)