Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ruleguard/typematch: use external matcher state (#374)
This is the same trick we did with gogrep matcher. The caller is supposed to pass the state that is not shared between different threads. For the most use cases, ruleguard has worker/runner based concurrency, so it's easy to pass this state from the worker that owns that state and doesn't share it with other workers. Also added some E2E tests that compile a ruleguard binary with `-race` and run it using all test rules over the ruleguard own source code. If any of these rules cause a data race, this test fails. To avoid the slower test times, I removed the `-race` from the basic test as they do not involve any concurrent behavior anyway, so it was just a waste of time. Fixes #372 Fixes #368
- Loading branch information
Showing
10 changed files
with
135 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
.idea | ||
.vscode | ||
test-ruleguard | ||
test-ruleguard-ir | ||
test-ruleguard.exe | ||
test-ruleguard-ir.exe | ||
coverage.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package regression | ||
|
||
func _() { | ||
_ = map[string]int{} // want `\Qcreating a map` | ||
_ = make(map[int][]string) // want `\Qcreating a map` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.