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

Revive has data races #677

Closed
zimmski opened this issue Apr 8, 2022 · 1 comment · Fixed by #678
Closed

Revive has data races #677

zimmski opened this issue Apr 8, 2022 · 1 comment · Fixed by #678
Assignees

Comments

@zimmski
Copy link
Contributor

zimmski commented Apr 8, 2022

Describe the bug
When compiled with the race detector on, data races are printed. I would expect no races.

Here is the output i receive:

==================
WARNING: DATA RACE
Read at 0x00c000132090 by goroutine 27:
  github.com/mgechev/revive/rule.(*ImportsBlacklistRule).Apply()
      /home/zimmski/symflower/src/github.com/mgechev/revive/rule/imports-blacklist.go:22 +0xa9
  github.com/mgechev/revive/lint.(*File).lint()
      /home/zimmski/symflower/src/github.com/mgechev/revive/lint/file.go:105 +0x201
  github.com/mgechev/revive/lint.(*Package).lint.func1()
      /home/zimmski/symflower/src/github.com/mgechev/revive/lint/package.go:173 +0x104
  github.com/mgechev/revive/lint.(*Package).lint.func2()
      /home/zimmski/symflower/src/github.com/mgechev/revive/lint/package.go:175 +0x47

Previous write at 0x00c000132090 by goroutine 23:
  github.com/mgechev/revive/rule.(*ImportsBlacklistRule).Apply()
      /home/zimmski/symflower/src/github.com/mgechev/revive/rule/imports-blacklist.go:23 +0xe6
  github.com/mgechev/revive/lint.(*File).lint()
      /home/zimmski/symflower/src/github.com/mgechev/revive/lint/file.go:105 +0x201
  github.com/mgechev/revive/lint.(*Package).lint.func1()
      /home/zimmski/symflower/src/github.com/mgechev/revive/lint/package.go:173 +0x104
  github.com/mgechev/revive/lint.(*Package).lint.func2()
      /home/zimmski/symflower/src/github.com/mgechev/revive/lint/package.go:175 +0x47

Goroutine 27 (running) created at:
  github.com/mgechev/revive/lint.(*Package).lint()
      /home/zimmski/symflower/src/github.com/mgechev/revive/lint/package.go:172 +0xeb
  github.com/mgechev/revive/lint.(*Linter).lintPackage()
      /home/zimmski/symflower/src/github.com/mgechev/revive/lint/linter.go:107 +0x2b7
  github.com/mgechev/revive/lint.(*Linter).Lint.func1()
      /home/zimmski/symflower/src/github.com/mgechev/revive/lint/linter.go:64 +0x137
  github.com/mgechev/revive/lint.(*Linter).Lint.func3()
      /home/zimmski/symflower/src/github.com/mgechev/revive/lint/linter.go:69 +0x66

Goroutine 23 (running) created at:
  github.com/mgechev/revive/lint.(*Package).lint()
      /home/zimmski/symflower/src/github.com/mgechev/revive/lint/package.go:172 +0xeb
  github.com/mgechev/revive/lint.(*Linter).lintPackage()
      /home/zimmski/symflower/src/github.com/mgechev/revive/lint/linter.go:107 +0x2b7
  github.com/mgechev/revive/lint.(*Linter).Lint.func1()
      /home/zimmski/symflower/src/github.com/mgechev/revive/lint/linter.go:64 +0x137
  github.com/mgechev/revive/lint.(*Linter).Lint.func3()
      /home/zimmski/symflower/src/github.com/mgechev/revive/lint/linter.go:69 +0x66
==================
==================
WARNING: DATA RACE
Read at 0x00c000c00000 by goroutine 27:
  runtime.mapaccess1_faststr()
      /home/zimmski/symflower/go/src/runtime/map_faststr.go:13 +0x0
  github.com/mgechev/revive/rule.(*ImportsBlacklistRule).Apply()
      /home/zimmski/symflower/src/github.com/mgechev/revive/rule/imports-blacklist.go:40 +0x288
  github.com/mgechev/revive/lint.(*File).lint()
      /home/zimmski/symflower/src/github.com/mgechev/revive/lint/file.go:105 +0x201
  github.com/mgechev/revive/lint.(*Package).lint.func1()
      /home/zimmski/symflower/src/github.com/mgechev/revive/lint/package.go:173 +0x104
  github.com/mgechev/revive/lint.(*Package).lint.func2()
      /home/zimmski/symflower/src/github.com/mgechev/revive/lint/package.go:175 +0x47

Previous write at 0x00c000c00000 by goroutine 23:
  runtime.mapassign_faststr()
      /home/zimmski/symflower/go/src/runtime/map_faststr.go:203 +0x0
  github.com/mgechev/revive/rule.(*ImportsBlacklistRule).Apply()
      /home/zimmski/symflower/src/github.com/mgechev/revive/rule/imports-blacklist.go:34 +0x5ca
  github.com/mgechev/revive/lint.(*File).lint()
      /home/zimmski/symflower/src/github.com/mgechev/revive/lint/file.go:105 +0x201
  github.com/mgechev/revive/lint.(*Package).lint.func1()
      /home/zimmski/symflower/src/github.com/mgechev/revive/lint/package.go:173 +0x104
  github.com/mgechev/revive/lint.(*Package).lint.func2()
      /home/zimmski/symflower/src/github.com/mgechev/revive/lint/package.go:175 +0x47

Goroutine 27 (running) created at:
  github.com/mgechev/revive/lint.(*Package).lint()
      /home/zimmski/symflower/src/github.com/mgechev/revive/lint/package.go:172 +0xeb
  github.com/mgechev/revive/lint.(*Linter).lintPackage()
      /home/zimmski/symflower/src/github.com/mgechev/revive/lint/linter.go:107 +0x2b7
  github.com/mgechev/revive/lint.(*Linter).Lint.func1()
      /home/zimmski/symflower/src/github.com/mgechev/revive/lint/linter.go:64 +0x137
  github.com/mgechev/revive/lint.(*Linter).Lint.func3()
      /home/zimmski/symflower/src/github.com/mgechev/revive/lint/linter.go:69 +0x66

Goroutine 23 (running) created at:
  github.com/mgechev/revive/lint.(*Package).lint()
      /home/zimmski/symflower/src/github.com/mgechev/revive/lint/package.go:172 +0xeb
  github.com/mgechev/revive/lint.(*Linter).lintPackage()
      /home/zimmski/symflower/src/github.com/mgechev/revive/lint/linter.go:107 +0x2b7
  github.com/mgechev/revive/lint.(*Linter).Lint.func1()
      /home/zimmski/symflower/src/github.com/mgechev/revive/lint/linter.go:64 +0x137
  github.com/mgechev/revive/lint.(*Linter).Lint.func3()
      /home/zimmski/symflower/src/github.com/mgechev/revive/lint/linter.go:69 +0x66
==================
==================
WARNING: DATA RACE
Read at 0x00c0000aa0a8 by goroutine 23:
  github.com/mgechev/revive/lint.(*Package).IsMain()
      /home/zimmski/symflower/src/github.com/mgechev/revive/lint/package.go:39 +0x84
  github.com/mgechev/revive/rule.(*BlankImportsRule).Apply()
      /home/zimmski/symflower/src/github.com/mgechev/revive/rule/blank-imports.go:20 +0x3e
  github.com/mgechev/revive/lint.(*File).lint()
      /home/zimmski/symflower/src/github.com/mgechev/revive/lint/file.go:105 +0x201
  github.com/mgechev/revive/lint.(*Package).lint.func1()
      /home/zimmski/symflower/src/github.com/mgechev/revive/lint/package.go:173 +0x104
  github.com/mgechev/revive/lint.(*Package).lint.func2()
      /home/zimmski/symflower/src/github.com/mgechev/revive/lint/package.go:175 +0x47

Previous write at 0x00c0000aa0a8 by goroutine 35:
  github.com/mgechev/revive/lint.(*Package).IsMain()
      /home/zimmski/symflower/src/github.com/mgechev/revive/lint/package.go:50 +0x472
  github.com/mgechev/revive/rule.(*BlankImportsRule).Apply()
      /home/zimmski/symflower/src/github.com/mgechev/revive/rule/blank-imports.go:20 +0x3e
  github.com/mgechev/revive/lint.(*File).lint()
      /home/zimmski/symflower/src/github.com/mgechev/revive/lint/file.go:105 +0x201
  github.com/mgechev/revive/lint.(*Package).lint.func1()
      /home/zimmski/symflower/src/github.com/mgechev/revive/lint/package.go:173 +0x104
  github.com/mgechev/revive/lint.(*Package).lint.func2()
      /home/zimmski/symflower/src/github.com/mgechev/revive/lint/package.go:175 +0x47

Goroutine 23 (running) created at:
  github.com/mgechev/revive/lint.(*Package).lint()
      /home/zimmski/symflower/src/github.com/mgechev/revive/lint/package.go:172 +0xeb
  github.com/mgechev/revive/lint.(*Linter).lintPackage()
      /home/zimmski/symflower/src/github.com/mgechev/revive/lint/linter.go:107 +0x2b7
  github.com/mgechev/revive/lint.(*Linter).Lint.func1()
      /home/zimmski/symflower/src/github.com/mgechev/revive/lint/linter.go:64 +0x137
  github.com/mgechev/revive/lint.(*Linter).Lint.func3()
      /home/zimmski/symflower/src/github.com/mgechev/revive/lint/linter.go:69 +0x66

Goroutine 35 (finished) created at:
  github.com/mgechev/revive/lint.(*Package).lint()
      /home/zimmski/symflower/src/github.com/mgechev/revive/lint/package.go:172 +0xeb
  github.com/mgechev/revive/lint.(*Linter).lintPackage()
      /home/zimmski/symflower/src/github.com/mgechev/revive/lint/linter.go:107 +0x2b7
  github.com/mgechev/revive/lint.(*Linter).Lint.func1()
      /home/zimmski/symflower/src/github.com/mgechev/revive/lint/linter.go:64 +0x137
  github.com/mgechev/revive/lint.(*Linter).Lint.func3()
      /home/zimmski/symflower/src/github.com/mgechev/revive/lint/linter.go:69 +0x66
==================
Found 3 data race(s)

To Reproduce
Steps to reproduce the behavior:

  1. go install -race github.com/mgechev/revive
  2. revive github.com/...
@zimmski
Copy link
Contributor Author

zimmski commented Apr 8, 2022

We btw test with -race on in our CI. Helps to find issues like this with the usual tests. Maybe part of this issue should be to add -race when everything is fixed there?

@chavacava chavacava self-assigned this Apr 8, 2022
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 a pull request may close this issue.

2 participants