On 1/10/23 11:42, Daniel Jankins wrote:
Hi,
Why can you update a value in a map struct?
Sort answer, because m["foo"] is not addressable, but you can have the
desired behavior using a temp variable:
func f() {
m := make(map[string]struct{ i int })
x := m["foo"]
x.i = 42
m["foo"] = x
}
BR.
-- w
--
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/dba18fd2-55cc-148b-48b2-6ae8ba90aa29%40104d.net.