Is there a reason not to retain the returned value from `mapiterkey` on
line 1243 of reflect/value.go[1] for use on line 1249[2].

```
// Key returns the key of the iterator's current map entry.
func (it *MapIter) Key() Value {
        if it.it == nil {
                panic("MapIter.Key called before Next")
        }
        if mapiterkey(it.it) == nil { //L1243
                panic("MapIter.Key called on exhausted iterator")
        }

        t := (*mapType)(unsafe.Pointer(it.m.typ))
        ktype := t.key
        return copyVal(ktype, it.m.flag.ro()|flag(ktype.Kind()), 
mapiterkey(it.it)) // L1249
}
```

The same question applies to `*MapIter.Value` method just below `Key`.

thanks
Dan

[1]
https://github.com/golang/go/blob/96e83664378918980bd8f60822c4bc39befcb668/src/reflect/value.go#L1243
[2]
https://github.com/golang/go/blob/96e83664378918980bd8f60822c4bc39befcb668/src/reflect/value.go#L1249


-- 
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/c9e63667e67228e2486460d1e79aa01568b633d3.camel%40kortschak.io.

Reply via email to