DEV Community


Discussion on: Go's method receiver: Pointer vs Value

808x86 profile image
808x86 • Edited

Just a note: value types are not necessarily safe for concurrent access: e.g. A struct where the fields are not value types. For instance, mutating a field of type slice is not safe (reference type).
A field of type map is not safe for concurrent access as soon as there are inserts as well (unless the inserts are mutex protected) . A sync.Map should be used. :)