stathat/consistent — pull request #4 by edsrzf (2013-12-21 02:53:12+00:00)
Title: Fix a concurrency bug

Because Consistent's scratch field was only protected by a
read lock, it was possible for two goroutines to try to hash
a key and write to scratch at the same time, producing the
wrong hash.

I've removed it from the Consistent struct and put it into the
function. Because of escape analysis, it is allocated on the
stack and still avoids a heap allocation. Run BenchmarkMalloc
or examine the assembly to verify.