---
title: "Comment by Eduardo Bonzi da Conceição on \"Sharing Memory by Communicating in Golang\" | Hashnode"
description: "I know this is a simple example but channels don&#39;t guarantee exclusive access, if you modify newData (it being a pointer) anywhere else in your code you&#39"
url: "https://hashnode.com/posts/sharing-memory-by-communicating-in-golang/603e7f2bff443a0a4499e1b0/comment/60917b858c38d5300e68a73b"
---

[Discussion](https://hashnode.com/posts/sharing-memory-by-communicating-in-golang/603e7f2bff443a0a4499e1b0)

Comment [Sharing Memory by Communicating in Golang](https://hashnode.com/posts/sharing-memory-by-communicating-in-golang/603e7f2bff443a0a4499e1b0)

[Eduardo Bonzi da Conceição](https://hashnode.com/@eduardobonzi)

[May 4, 2021](https://hashnode.com/posts/sharing-memory-by-communicating-in-golang/603e7f2bff443a0a4499e1b0/comment/60917b858c38d5300e68a73b)

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`).

[Nithin Thomas](https://hashnode.com/@Brotchu)

[May 4, 2021](https://hashnode.com/posts/sharing-memory-by-communicating-in-golang/603e7f2bff443a0a4499e1b0/comment/60917b858c38d5300e68a73b#reply-609194948c38d5300e68a833)

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

[Eduardo Bonzi da Conceição](https://hashnode.com/@eduardobonzi)

[May 6, 2021](https://hashnode.com/posts/sharing-memory-by-communicating-in-golang/603e7f2bff443a0a4499e1b0/comment/60917b858c38d5300e68a73b#reply-60933880a7a3827bb64cd158)

[Nithin Thomas](https://hashnode.com/@Brotchu)

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.
