Say I have a []T that I want to use as a common stem that has a tail
appended onto it, used concurrently, for example:

for i := 0; i < N; i++ {
        tail := makeTail(i) // Returns a []T.
        wg.Add(1)
        go func() {
                defer wg.Done()
                a := append(stem, tail...)
                fn(a) // Does something expensive with a []T.
        }()
}
wg.Wait()

This looks racy to me, since each append can potentially clobber
elements in stem between len(stem) and cap(stem). Am I being paranoid
or should I write this append as append(stem[:len(stem):len(stem)],
tail...)?

I have not been able to get the race detector to complain about this,
even if I make len << cap.

thanks

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to