Map initializes m when it points to nil.
(m *M)
| 25 | |
| 26 | // Map initializes m when it points to nil. |
| 27 | func Map[M ~map[K]V, K comparable, V any](m *M) { |
| 28 | // See https://pkg.go.dev/maps for similar type constraints. |
| 29 | |
| 30 | if m != nil && *m == nil { |
| 31 | *m = make(M) |
| 32 | } |
| 33 | } |
| 34 | |
| 35 | // Pointer returns a pointer to v. |
| 36 | func Pointer[T any](v T) *T { return &v } |
no outgoing calls