[Merge] lp:~sergiusens/account-polld/account-polld intolp:account-polld

James Henstridge james.henstridge at canonical.com
Tue Jul 15 01:04:21 UTC 2014


> > Also, "data" is going to be changed each time through this
> > loop, so storing "&data" in the account is going to result in
> > every account poller using the tokens for the most recent
> > account.
> 
> Hmm, I might be missing something; I storing an '*Account' in the accounts
> map with the keys here for the AccountId; I'll take a closer look in case
> missed something.
> 
> I should probably change the Accounts type to a different name to avoid
> confusions as well.

It's not the *Account variable that is the problem: it's the *accounts.AuthData pointer inside it.  With the code as it stands, every *Account will contain a pointer to the same *accounts.AuthData struct that gets updated every iteration of the loop.

See http://play.golang.org/p/iypZJ3y-ng for example: it doesn't print out the numbers 0-9, but instead prints "9" 10 times.
-- 
https://code.launchpad.net/~sergiusens/account-polld/account-polld/+merge/226620
Your team Ubuntu Phablet Team is subscribed to branch lp:account-polld.



More information about the Ubuntu-reviews mailing list