Yes.
If you manipulate the meaning of the index (i) or the length of the slice,
then do it explicitly:
for i := 0; i < len(a); i++ {
if a[i] == 0 { //delete
a[i]=a[0]
a = a[1:]
i--
}
}
For other methods, see
https://go.dev/wiki/SliceTricks#filtering-without-allocating
Shivansh
In https://go.dev/issue/52545 we saw failures in the cmd/go tests on Google
Cloud VMs due to a combination of a small number of available NAT ports and
port exhaustion from TIME_WAIT connections, but the failure mode there was
different (timed-out git commands rather than "cannot assign requeste
Hi Guys, I had a question regarding:
> On the other hand, if you have `for i, v := range a {` then the
> expression *is* evaluated before the start of the loop.
I have a code (https://goplay.tools/snippet/dMwD0_rEhkB) where I am ranging
over a slice, and updating (removing the zeroth element for