Closed
Description
deadcode
produces false positives if there is a main_test.go
file which is part of the main
package. To reproduce, create the following files:
main.go
:
package main
import "fmt"
func main() {
fmt.Println("derp")
}
main_test.go
:
package main
import (
"fmt"
"testing"
)
func TestMain(t *testing.T) {
fmt.Println("herp")
}
This produces the following error message when running golangci-lint run
:
main_test.go:8:6: `TestMain` is unused (deadcode)
func TestMain(t *testing.T) {
^
The false positive doesn't occur, if the package of the testing file is changed to main_test
.