mleku on Nostr: i have been hammering away at trying to isolate the location where i'm getting some ...
i have been hammering away at trying to isolate the location where i'm getting some kind of bogus data being overwritten in a race - or something - and i've spent so many hours chasing this one
out of all the bug types that i encounter in #golang the worst kind are scope shadowing bugs
these are usually where a variable is given a name in one scope, and then inside the same scope another inner scope block declares this variable again, and then later accesses see one version and others see others
i know it's not a concurrency bug because i've eliminated that by ensuring the values are copied so there's still some little sneaky bastid variable pretending to be some other variable that is kicking my arse right now
i need a break lol... fucking scope shadow bugs
i know i'm gonna kick myself when i finally see it because it's gonna be really obvious, and when i find it, oh man... the way it caused this error is gonna be firmly stamped into my memory, i might even print out a screenshot of the bug and hang it on my wall for a while so i don't forget how it happened and get better at learning to see it
the absolute worst... when it all looks right and yet somehow variables contain things that the superficial reading of the code says it should, the worst kind of bug of all, it's the one thing that is still wrong in #golang
i am pretty sure i have even declared this on the golang nuts mailing list, that scope shadowing should be an error
#devstr #deardiary
out of all the bug types that i encounter in #golang the worst kind are scope shadowing bugs
these are usually where a variable is given a name in one scope, and then inside the same scope another inner scope block declares this variable again, and then later accesses see one version and others see others
i know it's not a concurrency bug because i've eliminated that by ensuring the values are copied so there's still some little sneaky bastid variable pretending to be some other variable that is kicking my arse right now
i need a break lol... fucking scope shadow bugs
i know i'm gonna kick myself when i finally see it because it's gonna be really obvious, and when i find it, oh man... the way it caused this error is gonna be firmly stamped into my memory, i might even print out a screenshot of the bug and hang it on my wall for a while so i don't forget how it happened and get better at learning to see it
the absolute worst... when it all looks right and yet somehow variables contain things that the superficial reading of the code says it should, the worst kind of bug of all, it's the one thing that is still wrong in #golang
i am pretty sure i have even declared this on the golang nuts mailing list, that scope shadowing should be an error
#devstr #deardiary