From ca47e757bc07c5958fac95777ab585f34d43012b Mon Sep 17 00:00:00 2001 From: Neur0toxine Date: Fri, 14 Jun 2024 18:17:54 +0300 Subject: [PATCH] fix race & prettier test output --- .github/workflows/ci.yml | 4 +++- core/localizer_test.go | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 58371b7..893c74e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -46,7 +46,9 @@ jobs: - name: Get dependencies run: go mod tidy - name: Tests - run: go test ./... -v -cpu 2 -timeout 30s -race -cover -coverprofile=coverage.txt -covermode=atomic + run: | + go install gotest.tools/gotestsum@latest + gotestsum --format testdox ./... -v -cpu 2 -timeout 30s -race -cover -coverprofile=coverage.txt -covermode=atomic - name: Coverage run: | go install github.com/axw/gocov/gocov@latest diff --git a/core/localizer_test.go b/core/localizer_test.go index 35050fa..4190974 100644 --- a/core/localizer_test.go +++ b/core/localizer_test.go @@ -102,7 +102,6 @@ func (l *LocalizerTest) Test_LocalizationMiddleware_Context() { func (l *LocalizerTest) Test_LocalizationMiddleware_Httptest() { var wg sync.WaitGroup - r := rand.New(rand.NewSource(time.Now().UnixNano())) // nolint:gosec l.localizer.Preload(DefaultLanguages) langMsgMap := map[language.Tag]string{ language.English: "Test message", @@ -120,6 +119,7 @@ func (l *LocalizerTest) Test_LocalizationMiddleware_Httptest() { for i := 0; i < 1000; i++ { wg.Add(1) go func(m map[language.Tag]string, wg *sync.WaitGroup) { + r := rand.New(rand.NewSource(time.Now().UnixNano() + int64(i))) // nolint:gosec var tag language.Tag switch r.Intn(3-1) + 1 { // nolint:gosec case 1: