I know this is a simple example but channels don't guarantee exclusive access, if you modify newData (it being a pointer) anywhere else in your code you'll probably run into a race condition.
(Also there a few typos in your code, like the name of the channel in main and d.list which should be d.numbers).
Thank you,
If I understand correctly, newData should be only passed into the channel and not used anywhere else, since it is a pointer. So in such approach the pointer has to be used exculsively through the channel to avoid a race condition. Also, I have fixed the typos
Exactly, since you're not using a mutex, you'll run into race conditions if you modify newData somewhere else in your code while one of your goroutines is also modifying it.
Eduardo Bonzi da Conceição
I know this is a simple example but channels don't guarantee exclusive access, if you modify
newData(it being a pointer) anywhere else in your code you'll probably run into a race condition.(Also there a few typos in your code, like the name of the channel in
mainandd.listwhich should bed.numbers).