We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Let's say we have two files:
package main func foo() int { return 0 } func main() { }
and
//go:build sometag package main import ( "github.com/stretchr/testify/assert" "testing" ) func TestFoo(t *testing.T) { assert.Equal(t, 0, foo()) }
Is foo() unused?
foo()
$ staticcheck -f binary > tmp1 $ staticcheck -tags=sometag -f binary > tmp2 $ staticcheck -merge tmp1 tmp2 main.go:3:6: func foo is unused (U1000)
But is it?
We can move foo() to the second file, but is it correct to mark it as unused in such case? If yes, then why do we need merge at all?
The text was updated successfully, but these errors were encountered:
Anyway if we say that if function is used only in tests is still unused, then without tag:
package main import ( "github.com/stretchr/testify/assert" "testing" ) func TestFoo(t *testing.T) { assert.Equal(t, 0, foo()) }
It also should be unused, right? But it is not:
$ staticcheck $
Sorry, something went wrong.
I'll have to investigate this. At first glance the observed behavior in your first comment seems incorrect.
cc140e9
lintcmd: export fields necessary for gob encoding, again
9aa5199
Updates: gh-1370 Closes: gh-1372 (cherry picked from commit cc140e9)
No branches or pull requests
Let's say we have two files:
and
Is
foo()
unused?But is it?
We can move
foo()
to the second file, but is it correct to mark it as unused in such case? If yes, then why do we need merge at all?The text was updated successfully, but these errors were encountered: