Hacker News new | ask | show | jobs
by akira2501 897 days ago
I wrote it that way because that was I was looking at in the example code. You're mostly right. The example from my own code, of course, looks more like this:

https://go.dev/play/p/qdjnH3JhzTN

Which does work because the rules on := are loose, but the if captured version creates a new scope that can't be shared with the return variable.