100-go-mistakes/04-control-structures/32-range-loop-pointers/concepts/main.go
2021-12-27 15:57:20 +01:00

27 lines
439 B
Go

package concepts
type Store struct {
m map[string]*Foo
}
func (s Store) Put(id string, foo *Foo) {
s.m[id] = foo
// ...
}
type Foo struct{}
func updateMapValue(mapValue map[string]LargeStruct, id string) {
value := mapValue[id]
value.foo = "bar"
mapValue[id] = value
}
func updateMapPointer(mapPointer map[string]*LargeStruct, id string) {
mapPointer[id].foo = "bar"
}
type LargeStruct struct {
foo string
_ [1024]int64
}