<commit_before>package semaphore

import (
	"testing"

	"github.com/stretchr/testify/require"
)

func TestSemaphore(t *testing.T) {
	var sem = New(1)
	var counter = 0
	for i := 0; i < 10; i++ {
		sem.Acquire()
		go func() {
			counter++
			sem.Release()
		}()
	}
	require.Equal(t, counter, 9)
}<commit_msg>fix: data race on test<commit_after>package semaphore

import (
	"testing"

	"github.com/stretchr/testify/require"
	"golang.org/x/sync/errgroup"
)

func TestSemaphore(t *testing.T) {
	var sem = New(1)
	var counter = 0
	var g errgroup.Group
	for i := 0; i < 10; i++ {
		sem.Acquire()
		g.Go(func() error {
			counter++
			sem.Release()
			return nil
		})
	}
	require.NoError(t, g.Wait())
	require.Equal(t, counter, 10)
}
{'fraction_non_alphanumeric': 0.16275862068965516, 'fraction_numerical': 0.01793103448275862, 'mean_word_length': 3.4, 'pattern_counts': {'":': 0, '<': 5, '<?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': '5806627', 'n_tokens_mistral': 331, 'n_tokens_neox': 300, 'n_words': 68}