-
-
Notifications
You must be signed in to change notification settings - Fork 403
Closed
Labels
Description
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?
$ 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?
Reactions are currently unavailable