{"action":"created","issue":{"url":"https://api.github.com/repos/hashicorp/go-immutable-radix/issues/8","repository_url":"https://api.github.com/repos/hashicorp/go-immutable-radix","labels_url":"https://api.github.com/repos/hashicorp/go-immutable-radix/issues/8/labels{/name}","comments_url":"https://api.github.com/repos/hashicorp/go-immutable-radix/issues/8/comments","events_url":"https://api.github.com/repos/hashicorp/go-immutable-radix/issues/8/events","html_url":"https://github.com/hashicorp/go-immutable-radix/issues/8","id":170436679,"number":8,"title":"LongestPrefix matching only works for string-based byte slice keys","user":{"login":"arussellsaw","id":5236823,"avatar_url":"https://avatars.githubusercontent.com/u/5236823?v=3","gravatar_id":"","url":"https://api.github.com/users/arussellsaw","html_url":"https://github.com/arussellsaw","followers_url":"https://api.github.com/users/arussellsaw/followers","following_url":"https://api.github.com/users/arussellsaw/following{/other_user}","gists_url":"https://api.github.com/users/arussellsaw/gists{/gist_id}","starred_url":"https://api.github.com/users/arussellsaw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arussellsaw/subscriptions","organizations_url":"https://api.github.com/users/arussellsaw/orgs","repos_url":"https://api.github.com/users/arussellsaw/repos","events_url":"https://api.github.com/users/arussellsaw/events{/privacy}","received_events_url":"https://api.github.com/users/arussellsaw/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-08-10T14:50:32Z","updated_at":"2016-08-10T15:02:24Z","closed_at":null,"body":"i'm trying to use this package for longest prefix IP subnet matching, however it seems that when used with non-string based keys, the prefix matching doesn't work. example here:\r\n\r\n```go\r\n\r\npackage main\r\n\r\nimport (\r\n    \"fmt\"\r\n\r\n    \"github.com/hashicorp/go-immutable-radix\"\r\n)\r\n\r\nfunc main() {\r\n\tr := iradix.New()\r\n\tr, _, _ = r.Insert([]byte(\"foo\"), 1)\r\n\tr, _, _ = r.Insert([]byte(\"foobar\"), 2)\r\n\tr, _, _ = r.Insert([]byte(\"foobarfoo\"), 3)\r\n\tr, _, _ = r.Insert([]byte(\"foobarfoobar\"), 4)\r\n\r\n\tk, v, ok := r.Root().LongestPrefix([]byte(\"foobarbaz\")) // finds correct prefix\r\n\tfmt.Println(string(k), v, ok)\r\n\r\n\tr = iradix.New()\r\n\tr, _, _ = r.Insert([]byte{10, 1, 1, 1}, 1)\r\n\tr, _, _ = r.Insert([]byte{10, 2, 1, 1}, 2)\r\n\tr, _, _ = r.Insert([]byte{10, 2, 3, 1}, 3)\r\n\tr, _, _ = r.Insert([]byte{10, 2, 3, 4}, 4)\r\n\r\n\tk, v, ok = r.Root().LongestPrefix([]byte{10, 2, 3, 10}) // can't find any prefix? should find 10,2,3,1: 3\r\n\tfmt.Println(string(k), v, ok)\r\n\tk, v, ok = r.Root().LongestPrefix([]byte{10, 2, 3, 4}) // only finds explicit match\r\n\tfmt.Println(string(k), v, ok)\r\n}\r\n```"},"comment":{"url":"https://api.github.com/repos/hashicorp/go-immutable-radix/issues/comments/238895293","html_url":"https://github.com/hashicorp/go-immutable-radix/issues/8#issuecomment-238895293","issue_url":"https://api.github.com/repos/hashicorp/go-immutable-radix/issues/8","id":238895293,"user":{"login":"arussellsaw","id":5236823,"avatar_url":"https://avatars.githubusercontent.com/u/5236823?v=3","gravatar_id":"","url":"https://api.github.com/users/arussellsaw","html_url":"https://github.com/arussellsaw","followers_url":"https://api.github.com/users/arussellsaw/followers","following_url":"https://api.github.com/users/arussellsaw/following{/other_user}","gists_url":"https://api.github.com/users/arussellsaw/gists{/gist_id}","starred_url":"https://api.github.com/users/arussellsaw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arussellsaw/subscriptions","organizations_url":"https://api.github.com/users/arussellsaw/orgs","repos_url":"https://api.github.com/users/arussellsaw/repos","events_url":"https://api.github.com/users/arussellsaw/events{/privacy}","received_events_url":"https://api.github.com/users/arussellsaw/received_events","type":"User","site_admin":false},"created_at":"2016-08-10T15:02:24Z","updated_at":"2016-08-10T15:02:24Z","body":"this was me misunderstanding how radix trees work 👍  💯  🎱 "}}
{"actor":{"display_login":"arussellsaw"}}