Diego Augusto Molina
unread,Jun 28, 2020, 4:45:34 PM6/28/20Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Sign in to report message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to golan...@googlegroups.com
Hi, I think I spotted a small typo in the draft. In Examples >
Containers we have:
<code>
// Find returns the value associated with a key, or zero if not present.
// The bool result reports whether the key was found.
func (m *Map(K, V)) Find(k K) (V, bool) {
pn := m.find(k)
if *pn == nil {
var zero val // see the discussion of zero values, above
return zero, false
}
return (*pn).v, true
}
</code>
Whereas I think it should be:
<code>
// Find returns the value associated with a key, or zero if not present.
// The bool result reports whether the key was found.
func (m *Map(K, V)) Find(k K) (V, bool) {
pn := m.find(k)
if *pn == nil {
var zero V // see the discussion of zero values, above
return zero, false
}
return (*pn).v, true
}
</code>
Patch attached.