-
Notifications
You must be signed in to change notification settings - Fork 60
Open
Description
Prefix is a named type of []byte, so passing it to put function (called by Set and Insert) passes a reference to the slice value. put should make a copy of the key:
t := patricia.NewTrie()
key := patricia.Prefix("foo")
t.Insert(key, true)
// alter the key slice
key[0] = 'b'
fmt.Println("boo key: ", t.Get(patricia.Prefix("boo")))
fmt.Println("foo key: ", t.Get(patricia.Prefix("foo")))
Output:
boo key: true
foo key: <nil>
Sending a pull request for a fix.
Metadata
Metadata
Assignees
Labels
No labels