Which is also the reason why you can't insert into a nil map - you have to 
make() one.

On Wednesday, 15 March 2023 at 10:58:09 UTC Dan Kortschak wrote:

> On Tue, 2023-03-14 at 19:56 -0700, Kurtis Rader wrote:
> > Maps are a special-case. You can't pass them "by value" in the sense
> > you mean because a "map" value is a very tiny structure that contains
> > a pointer to the actual map.
>
> The passed value is a pointer to the header, otherwise changes to maps
> would require the altered map to be returned as with slices and append.
>
> https://go.dev/play/p/avBBkNwVZRY
>
>

-- 
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/0ffd9d0d-b80a-4ec5-a772-40dfb102b43an%40googlegroups.com.

Reply via email to