Closed myzhan closed 12 months ago
in the first example you are passing a
by value so a copy of its contents is made. in the second example the function closure captures a
. you could replace a
with a pointer in the first example but you shouldn’t do that as it will trigger the race detector. your second example is the way to go (alternatively you can use channels)
Ah, now I see, thanks.
I write a testcase like this, and expect it to pass. But it's not.
Until I rewrite it like this.