Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dev: fix data race in TestCheckReplace #5

Merged
merged 4 commits into from
Mar 2, 2024
Merged

dev: fix data race in TestCheckReplace #5

merged 4 commits into from
Mar 2, 2024

Conversation

alexandear
Copy link
Member

This PR fixes the following data race when running go test -v -race .:

=== RUN   TestCheckReplace
=== RUN   TestCheckReplace/foo
=== PAUSE TestCheckReplace/foo
=== RUN   TestCheckReplace/foo_junk
=== PAUSE TestCheckReplace/foo_junk
=== RUN   TestCheckReplace/junk_foo
=== PAUSE TestCheckReplace/junk_foo
=== RUN   TestCheckReplace/junk_foo_junk
=== PAUSE TestCheckReplace/junk_foo_junk
=== CONT  TestCheckReplace/foo
=== CONT  TestCheckReplace/junk_foo_junk
=== CONT  TestCheckReplace/foo_junk
=== CONT  TestCheckReplace/junk_foo
==================
WARNING: DATA RACE
Write at 0x00c0013001e0 by goroutine 173:
  github.com/golangci/misspell.TestCheckReplace.func1()
      /Users/Oleksandr_Redko/src/github.com/golangci/misspell/replace_test.go:130 +0x98
  testing.tRunner()
      /usr/local/go/src/testing/testing.go:1595 +0x194
  testing.(*T).Run.func1()
      /usr/local/go/src/testing/testing.go:1648 +0x40

Previous write at 0x00c0013001e0 by goroutine 170:
  github.com/golangci/misspell.TestCheckReplace.func1()
      /Users/Oleksandr_Redko/src/github.com/golangci/misspell/replace_test.go:130 +0x98
  testing.tRunner()
      /usr/local/go/src/testing/testing.go:1595 +0x194
  testing.(*T).Run.func1()
      /usr/local/go/src/testing/testing.go:1648 +0x40

Goroutine 173 (running) created at:
  testing.(*T).Run()
      /usr/local/go/src/testing/testing.go:1648 +0x5d8
  github.com/golangci/misspell.TestCheckReplace()
      /Users/Oleksandr_Redko/src/github.com/golangci/misspell/replace_test.go:127 +0x534
  testing.tRunner()
      /usr/local/go/src/testing/testing.go:1595 +0x194
  testing.(*T).Run.func1()
      /usr/local/go/src/testing/testing.go:1648 +0x40

Goroutine 170 (finished) created at:
  testing.(*T).Run()
      /usr/local/go/src/testing/testing.go:1648 +0x5d8
  github.com/golangci/misspell.TestCheckReplace()
      /Users/Oleksandr_Redko/src/github.com/golangci/misspell/replace_test.go:127 +0x534
  testing.tRunner()
      /usr/local/go/src/testing/testing.go:1595 +0x194
  testing.(*T).Run.func1()
      /usr/local/go/src/testing/testing.go:1648 +0x40
==================
==================
WARNING: DATA RACE=== NAME  TestCheckReplace/junk_foo_junk

Write at 0x00c001308108 by goroutine 171:
    testing.go:1465: race detected during execution of test
  github.com/golangci/misspell.TestCheckReplace.func1()
      /Users/Oleksandr_Redko/src/github.com/golangci/misspell/replace_test.go:130 +0xd8
  testing.tRunner()
      /usr/local/go/src/testing/testing.go:1595 +0x194
  testing.(*T).Run.func1()
      /usr/local/go/src/testing/testing.go:1648 +0x40

Previous write at 0x00c001308108 by goroutine 170:
  github.com/golangci/misspell.TestCheckReplace.func1()
      /Users/Oleksandr_Redko/src/github.com/golangci/misspell/replace_test.go:130 +0xd8
  testing.tRunner()
      /usr/local/go/src/testing/testing.go:1595 +0x194
  testing.(*T).Run.func1()
      /usr/local/go/src/testing/testing.go:1648 +0x40

Goroutine 171 (running) created at:
  testing.(*T).Run()
      /usr/local/go/src/testing/testing.go:1648 +0x5d8
  github.com/golangci/misspell.TestCheckReplace()
      /Users/Oleksandr_Redko/src/github.com/golangci/misspell/replace_test.go:127 +0x534
  testing.tRunner()
      /usr/local/go/src/testing/testing.go:1595 +0x194
  testing.(*T).Run.func1()
      /usr/local/go/src/testing/testing.go:1648 +0x40

Goroutine 170 (finished) created at:
  testing.(*T).Run()
      /usr/local/go/src/testing/testing.go:1648 +0x5d8
  github.com/golangci/misspell.TestCheckReplace()
      /Users/Oleksandr_Redko/src/github.com/golangci/misspell/replace_test.go:127 +0x534
  testing.tRunner()
      /usr/local/go/src/testing/testing.go:1595 +0x194
  testing.(*T).Run.func1()
      /usr/local/go/src/testing/testing.go:1648 +0x40
==================
=== NAME  TestCheckReplace/foo_junk
    replace_test.go:132: basic recheck failed "food pruning" vs "junk foobar junk"
    testing.go:1465: race detected during execution of test
--- FAIL: TestCheckReplace (0.00s)
    --- PASS: TestCheckReplace/foo (0.00s)
    --- PASS: TestCheckReplace/junk_foo (0.00s)
    --- FAIL: TestCheckReplace/junk_foo_junk (0.00s)
    --- FAIL: TestCheckReplace/foo_junk (0.00s)

@alexandear alexandear requested a review from ldez October 12, 2023 09:59
@alexandear
Copy link
Member Author

Hello @ldez,

I submitted this pull request a while ago and it appears to be pending review. I understand you're busy, but if you could find some time to look at it, I would greatly appreciate your feedback.

Thank you for your time and consideration.

@ldez ldez merged commit fd7b9c1 into golangci:master Mar 2, 2024
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants