That's correct. I've found that it's most often a mistake when working with
slices. But for maps, there is some use for it, such as relying on maps
being unordered to select random values from the map, although there should
be a better way to do that.
An analysis check for this should produce a
On Mon, Mar 15, 2021 at 3:03 AM Barisere Jonathan
wrote:
> I think this mistake can be caught by code analysis tools, but I don't know
> of any that catches these.
IMO the problem is that while sometimes it's a mistake, in some other
cases it is not and it is perfectly good, reasonable code.
Hello everyone.
I have a question about a common programming error I have made several
times. It regards the use of a pointer to a loop variable outside of the
loop. Basically, we want to convert a slice, map, or channel of items (the
source sequence) into a map, slice, or channel of pointers