Recently I implemented a heap in GO. To implement a heap, you have to implement Push() and Pop() as well as the 3 methods for sort: Less(),, Swap(), and Len(). For my heap, I never had to Push or Pop, I only had to initialize the heap and repeatedly "Fix" the top element of the heap. As it turns out the Init and Fix functions only use the 3 sorting methods of the heap. They don't use Push or Pop. So when I ran test coverage, I found that my Push and Pop implementations weren't covered. I can't leave my Push and Pop implementation out because the Init and Fix methods require heaps with all 5 methods. What do I do?
What is the preferred way in GO to implement methods of an interface that aren't really needed? Why don't the Init and Fix methods of container/heap just accept a sort.Interface? -- 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/8dab46b2-7c74-428f-8139-3f4e867e35b5n%40googlegroups.com.