Skip to content

make check's staticcheck step can never fail: '|| echo not installed' swallows real findings (67 on main) #923

Closed

Description

@scttfrdmn

Found while working on #913.

make check step 3 is:

@staticcheck ./... || echo "staticcheck not installed, skipping..."

|| fires on any non-zero exit, not only on "command not found". staticcheck exits 1 when it reports findings, so a run with findings prints staticcheck not installed, skipping... and the step passes. The step cannot fail.

Verified on main (38b2d66) with staticcheck installed (/opt/homebrew/bin/staticcheck):

$ make check
3. Running staticcheck...
staticcheck not installed, skipping...
$ staticcheck ./... | wc -l
      67

Examples: SA1019 (go/parser.ParseDir in api_surface_test.go:204), several ST1005, and U1000 (regexpMustCompile unused in cmd/inert_flags_test.go:328). CI doesn't run staticcheck or golangci-lint at all, so nothing checks these.

Suggested: distinguish the two cases, e.g. if command -v staticcheck >/dev/null; then staticcheck ./...; else echo "staticcheck not installed, skipping..."; fi. Then either fix the 67 findings or narrow the checks in a staticcheck.conf before the step can be made blocking, and decide whether CI should run it too. The message is also misleading as written: it says "not installed" about a tool that is installed and has just reported problems.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions