src/container/heap/heap.go: ```go func Pop(h Interface) interface{} { n := h.Len() - 1 h.Swap(0, n) down(h, 0, n) return h.Pop() } ```
While the h is empty, also the h.Len() equals to 0,why not return nil in advance? In the current way, we have to do boundary check in implement of Swap, otherwise there will be panic. -- 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/cb34d879-8bf6-42c3-82a8-220641b24a6f%40googlegroups.com.