This was discovered during work on issue #2.
At the end of a search, in order to avoid a race condition modifying the data prior to its return, a copy is intentionally made here.
Unfortunately, the operator used on line 180 ([]byte(db.data...)) is just a redundant cast operator on the slice. The slice itself is, of course, referencing the same memory as db.data. So no copy is actually created and the race condition still exists.
This can be fixed by either using make and copy or by appending the results to an empty slice.
This was discovered during work on issue #2.
At the end of a search, in order to avoid a race condition modifying the data prior to its return, a copy is intentionally made here.
Unfortunately, the operator used on line 180 (
[]byte(db.data...)) is just a redundant cast operator on the slice. The slice itself is, of course, referencing the same memory as db.data. So no copy is actually created and the race condition still exists.This can be fixed by either using
makeandcopyor byappending the results to an empty slice.