According to the staticcheck cli docs, the pkg pattern is parsed just like in normal Go commands. So ./... is the right way to test all pkgs recursively, including test files.
As to why this wasn't catching the ioutil deprecation warning (see previous discussion), I figured it out! ioutil was only deprecated in Go 1.19. Since your go.mod version is 1.16, staticcheck doesn't flag it. When you switched to *.go, it treated each Go file independently, which uses the system (not go.mod) Go version but also 1) might trigger false positives that lack pkg context to resolve and 2) doesn't recursively check things.
I think it's better to switch back to ./..., and if you want to catch those deprecation issues, bump the go version, at the risk of making problems for upstream deps.
According to the staticcheck cli docs, the pkg pattern is parsed just like in normal Go commands. So
./...
is the right way to test all pkgs recursively, including test files.As to why this wasn't catching the ioutil deprecation warning (see previous discussion), I figured it out!
ioutil
was only deprecated in Go 1.19. Since yourgo.mod
version is 1.16, staticcheck doesn't flag it. When you switched to*.go
, it treated each Go file independently, which uses the system (notgo.mod
) Go version but also 1) might trigger false positives that lack pkg context to resolve and 2) doesn't recursively check things.I think it's better to switch back to
./...
, and if you want to catch those deprecation issues, bump the go version, at the risk of making problems for upstream deps.