mirror of
https://github.com/scratchfoundation/golangci-lint.git
synced 2025-08-20 10:18:44 -04:00
Fix false positives with unused identifiers
Issue #265: don't report unused warning when an identifier is used only in tests.
This commit is contained in:
parent
3345c7136f
commit
ccac35a87e
5 changed files with 84 additions and 14 deletions
test
|
@ -163,6 +163,12 @@ func TestDeadcodeNoFalsePositivesInMainPkg(t *testing.T) {
|
|||
checkNoIssuesRun(t, out, exitCode)
|
||||
}
|
||||
|
||||
func TestIdentifierUsedOnlyInTests(t *testing.T) {
|
||||
out, exitCode := runGolangciLint(t, "--no-config", "--disable-all", "-Eunused",
|
||||
filepath.Join(testdataDir, "used_only_in_tests"))
|
||||
checkNoIssuesRun(t, out, exitCode)
|
||||
}
|
||||
|
||||
func TestConfigFileIsDetected(t *testing.T) {
|
||||
checkGotConfig := func(out string, exitCode int) {
|
||||
assert.Equal(t, exitcodes.Success, exitCode, out)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue