-
Notifications
You must be signed in to change notification settings - Fork 102
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
Do not deepcopy, instance can be nil #1185
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.
This isn't actually needed, DeepCopy()
handles the case that instance is nil
:
func (in *TestType) DeepCopy() *TestType {
if in == nil {
return nil
}
out := new(TestType)
in.DeepCopyInto(out)
return out
}
(neat Go trick btw)
oh, goland was complaining... I would still probably prefer to merge this in even though it's not fixing anything. Might be handy for people (and IDEs) who don't know deepcopy implementation and might freak them out as it did freak out me :D |
But |
omg yeah, you're right... I am starting to feel like we should get rid of these special getXX methods returning nil because it's just confusing, when it returns something different than k8s client. WDYT? |
I'm fine with having helper functions. Though there is similar code in |
Oh I was questioning the fact of returning nil vs not found error - I think it's confusing if 10% of code does nil, the rest err, also you need to check for nil etc. anyway so the code does not get that much nicer. But then I see that I already changed it here #850 just did not update the docs :D |
Signed-off-by: Andreas Neumann <aneumann@mesosphere.com>
No description provided.