Please review this patch. Since Go locks are not re-entrant, I most likely ran into the same problem you did with having Size() have a read lock. The solution is to have an internal size() method that doesn't lock and provide a public Size() method with the RLock on it. This way, all the other methods can check the internal size() method and we don't have to worry about re-entrancy issues. Please review this, but I think it looks good.
Please review this patch. Since Go locks are not re-entrant, I most likely ran into the same problem you did with having Size() have a read lock. The solution is to have an internal size() method that doesn't lock and provide a public Size() method with the RLock on it. This way, all the other methods can check the internal size() method and we don't have to worry about re-entrancy issues. Please review this, but I think it looks good.