masagroup/gocheck — pull request #1 by pmezard (2014-02-24 15:21:32+00:00)
Title: helpers: serialize access to helper methods

C being goroutine safe in client tests context is convenient. This change
serializes all access to exported methods defined in helpers.go. We assume
that client testsi goroutines will only access these, and access them only
during test duration. Benchmark methods are left unchanged as locking might
have to much impact on them, plus callers are not expected to run them
concurrently.

To avoid re-entrancy issues, exported methods were duplicated in non-exported
ones. Only exported ones Lock, and are forbidden to call other exported methods.

I am aware this scheme is a bit brittle, but we have tests and a quick look at
the code convinced me this should work.