Some time ago, Matt pointed out that there are race conditions in package “query”.
As the others have pointed out, this is coming from gotomic hash. If we run just one test in the gotomic package, the race detector will lit up:
go test -race github.com/zond/gotomic --run TestConcurrency
I suspect this is a red herring, and will look into how lock-free hash maps and how go race detector work tomorrow.
Note: The four packages that fail are query, commit, cmd/dgraph, cmd/dgraphloader.
Update: gotomic has been updated and the above test (TestConcurrency) now runs fine.