Closed aletheia7 closed 7 years ago
Allpfrefixed() incorrectly matches keys.
package main import ( "log" "github.com/k-sone/critbitgo" ) func main() { log.SetFlags(0) trie := critbitgo.NewTrie() trie.Insert([]byte("/ctrl_ready"), 1) trie.Insert([]byte("/router_message"), 2) trie.Insert([]byte("/router_ready"), 3) key := []byte("/router_message") trie.Allprefixed(key, func(key []byte, value interface{}) bool { log.Printf("Allprefixed: %s %v", key, value) return true }) }
Allprefixed: /router_message 2 Allprefixed: /router_ready 3
Allprefixed: /router_message 2
Thanks for the report!
Allpfrefixed() incorrectly matches keys.
Example
Example Output
Expected Output