-
Notifications
You must be signed in to change notification settings - Fork 40k
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
Fix a problem with for loops, copy semantics and async routines. #1616
Conversation
Oh, Go. You love your little landmines. |
LGTM is what I meant to say. |
Merging, since this is clearly a bug, and I think it's what's breaking e2e too. |
Fix a problem with for loops, copy semantics and async routines.
oh nice find, at first I didn't catch the extra copy. |
It's not the extra copy, it's that the pointer is to the loop variable On Tue, Oct 7, 2014 at 9:24 AM, Johan Euphrosine notifications@github.com
|
@brendanburns oh right, I also didn't catch we were passing a pointer to the loop variable. |
Good fix. How did this get in in the first place? If a reviewer just missed it, that's fine, it happens--but everyone needs to be aware of this class of problem. |
@lavalamp, I think it wasn't caught during review because it was mixed with another "medium" change. The last travis build for this change was passing, so I'm not sure if this area is covered: |
Does go vet or some other linter warn for this? This is EXACTLY what tools On Tue, Oct 7, 2014 at 10:37 AM, Daniel Smith notifications@github.com
|
@thockin sounds like good contributions to |
But it's not you - I've done this. I've seen it listed as a known landmine On Tue, Oct 7, 2014 at 10:48 AM, Johan Euphrosine notifications@github.com
|
Something else to note is that it is sometime "hard" to detect when you're calling into async code (no excuse here because of the |
Honestly, many of us are Go newbies (myself included), so it's not surprising that this was missed in review. |
Or just never use for _, ix { ... } semantics. It's both slower and error --brendan On Tue, Oct 7, 2014 at 12:41 PM, bgrant0607 notifications@github.com
|
It's legit when looping through a list/map of pointers and not saving On Tue, Oct 7, 2014 at 12:53 PM, Brendan Burns notifications@github.com
|
Yeah, that's true, but it's a hard enough rule to keep in my head (esp. On Tue, Oct 7, 2014 at 12:56 PM, Daniel Smith notifications@github.com
|
UPSTREAM: <carry>: when only this kube-apiserver can fulfill the kube…
@proppy @bgrant0607 Fixes a bug introduced by f91162c#diff-bf28da68f62a8df6e99e447c4351122dR637
Go lang for loop copy semantics and async routines are not friends.