-
Notifications
You must be signed in to change notification settings - Fork 55
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 DeepCopy for AppSpec #165
Conversation
drivers/scheduler/spec/spec.go
Outdated
out := new(AppSpec) | ||
out.Key = in.Key | ||
out.Enabled = in.Enabled | ||
out.SpecList = make([]interface{}, len(in.SpecList)) |
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.
either don't initialize the slice with the length, or don't use append
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.
Yeah, this will result in a speclist slice of double the size of in.speclist.
The kubernetes APIs are no longer in 1.10 which causes issues in projects that vendor torpedo. The recommended way is to generate deepcopy functions, but AppSpec is simple enough.
out.Enabled = in.Enabled | ||
out.SpecList = make([]interface{}, 0) | ||
for _, spec := range in.SpecList { | ||
out.SpecList = append(out.SpecList, spec) |
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.
not sure how this will work when spec is a pointer
as we discussed, in future when we run tests in parallel, and modify the specs, it could be a problem
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.
Yes, will need to be changed when we start running tests in parallel.
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.
Okay; let's put a TODO here and/or create an issue to track it.
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.
Created Issue #166
The kubernetes APIs are no longer in 1.10 which causes issues
in projects that vendor torpedo. The recommended way is to generate
deepcopy functions, but AppSpec is simple enough.