Skip to content

Commit

Permalink
lint: don't use -unused.whole-program when PKG is specified
Browse files Browse the repository at this point in the history
The unused linter's whole program mode will create false-positives
when PKG is specified. As a result, anyone trying to use

    make lint PKG=./pkg/SOMETHING

has to carefully read the failure output to see if it was actually a
success. By not passing that flag when PKG is specified, more cases of
the above command complete without erroneous findings.

Release note: None
  • Loading branch information
stevendanna committed Mar 23, 2021
1 parent 3f9f18e commit f49997b
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions pkg/testutils/lint/lint_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1608,12 +1608,16 @@ func TestLint(t *testing.T) {
t.Run("TestStaticCheck", func(t *testing.T) {
// staticcheck uses 2.4GB of ram (as of 2019-05-10), so don't parallelize it.
skip.UnderShort(t)
var args []string
if pkgSpecified {
args = []string{pkgScope}
} else {
args = []string{"-unused.whole-program", pkgScope}
}
cmd, stderr, filter, err := dirCmd(
crdb.Dir,
"staticcheck",
"-unused.whole-program",
pkgScope,
)
args...)
if err != nil {
t.Fatal(err)
}
Expand Down

0 comments on commit f49997b

Please sign in to comment.