-
Notifications
You must be signed in to change notification settings - Fork 721
Make Provision.Script a pointer #4211
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
Conversation
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
7b77052 to
842bc25
Compare
As the TODO in limayaml/defaults.go claims, change the type of "Script" under "type Provision struct" from "string" to "*string". Update all callers to pass a pointer and handle "nil" in comparisons, validation, and marshalling. Signed-off-by: I Hsin Cheng <richard120310@gmail.com>
842bc25 to
e7cb6aa
Compare
|
@AkihiroSuda - |
|
I think if y.Provision.Script == nil {
y.Provision.Script = ptr.Of("")
}instead of having I would also suggest to change |
@jandubois - Though I have a question, conventions like lima/pkg/driver/vz/vz_driver_darwin.go Line 224 in 3819d5b
Tbh
I get your idea on this part, just have question for the former part. |
I'm not concerned about the "cost" at all; it is trivial. I just want to simplify the code for the parts where having a value is not really optional anyways. With the exception of the Ansible provisioning mode, not having a script will result in an error during validation. So we could just as well keep the rest of the validation code simpler. It is also more maintenance friendly, as future changes cannot "forget" to check for In my mind, only |
Thanks for your explanation ! makes sense to me, I'll ammend them up ASAP. |
Change the type of "Script" under "type Probe struct" from "string" to "*string". Make it consistent with "Provision.Script". Check lima-vm#4211 for details. Signed-off-by: I Hsin Cheng <richard120310@gmail.com>
Summary
As the TODO in limayaml/defaults.go claims, change the type of
"Script" under "type Provision struct" from "string" to "*string".
Update all callers to pass a pointer and handle "nil" in comparisons,
validation, and marshalling.