<commit_before>package gock

import (
	"sync"
)

// storeMutex is used interally for store synchronization.
var storeMutex = sync.RWMutex{}

// mocks is internally used to store registered mocks.
var mocks = []Mock{}

// Register registers a new mock in the current mocks stack.
func Register(mock Mock) {
	if Exists(mock) {
		return
	}

	// Make ops thread safe
	storeMutex.Lock()
	defer storeMutex.Unlock()

	// Expose mock in request/response for delegation
	mock.Request().Mock = mock
	mock.Response().Mock = mock

	// Registers the mock in the global store
	mocks = append(mocks, mock)
}

// GetAll returns the current stack of registed mocks.
func GetAll() []Mock {
	storeMutex.RLock()
	defer storeMutex.RUnlock()
	return mocks
}

// Exists checks if the given Mock is already registered.
func Exists(m Mock) bool {
	storeMutex.RLock()
	defer storeMutex.RUnlock()
	for _, mock := range mocks {
		if mock == m {
			return true
		}
	}<commit_msg>fix typo (#99)<commit_after>package gock

import (
	"sync"
)

// storeMutex is used interally for store synchronization.
var storeMutex = sync.RWMutex{}

// mocks is internally used to store registered mocks.
var mocks = []Mock{}

// Register registers a new mock in the current mocks stack.
func Register(mock Mock) {
	if Exists(mock) {
		return
	}

	// Make ops thread safe
	storeMutex.Lock()
	defer storeMutex.Unlock()

	// Expose mock in request/response for delegation
	mock.Request().Mock = mock
	mock.Response().Mock = mock

	// Registers the mock in the global store
	mocks = append(mocks, mock)
}

// GetAll returns the current stack of registered mocks.
func GetAll() []Mock {
	storeMutex.RLock()
	defer storeMutex.RUnlock()
	return mocks
}

// Exists checks if the given Mock is already registered.
func Exists(m Mock) bool {
	storeMutex.RLock()
	defer storeMutex.RUnlock()
	for _, mock := range mocks {
		if mock == m {
			return true
		}
	}
{'fraction_non_alphanumeric': 0.1024697845507094, 'fraction_numerical': 0.0010509721492380452, 'mean_word_length': 3.5879518072289156, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1100017', 'n_tokens_mistral': 623, 'n_tokens_neox': 616, 'n_words': 220}