When I retrieve a struct from a map in Go, do I get a copy of the value? Or do I get the actual value that's in the map?
For example, let's say I have a map from strings to structs:
type quality struct {
goodness int
crunchiness int
}
cookies := make(map[string]quality)
cookies["nutrageous"] = quality{goodness: 3, crunchiness: 10}
and I want to modify an entry.
Can I count on the returned value being the same as what's in the map?
c := cookies["nutrageous"]
c.goodness += 5
Or do I also have to go back and modify what's in the map?
c := cookies["nutrageous"]
c.goodness += 5
cookies["nutrageous"] = c