I have a struct that will be used concurrently.

type A struct {
    sync.Mutex
    id string
    // other members
    ...
}

The other members of A will be concurrently read or written. So I think I 
have to hold lock of A for those.

But A.id will be written once at creation time of A (when it was not 
handled concurrently, yet) and will only be read after then.

Should I lock A to read A.id, or is it safe to read concurrently without it?

Thanks in advance.

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/1e7df2af-b26e-403f-a8a4-41170b2d2aeen%40googlegroups.com.

Reply via email to