Describe the bug
revive's package-directory-mismatch reports a false positive for the usage of the package main_test on the test file main_test.go related to main.go.
To Reproduce
Steps to reproduce the behavior:
- I updated revive
go install github.com/mgechev/revive@latest
- I run it with the following flags & configuration file:
revive -config myservice/reviveconfig.toml myservice/main_test.go
Expected behavior
I expect package main_test to be accepted by revive without throwing a warning.
Logs
revive's output: myservice/main_test.go:1:9: package name "main_test" does not match directory name "myservice".
Desktop (please complete the following information):
- OS: macOS 15.6.1 (24G90)
- Go 1.25.1
Additional context
revive seems to only detect this as an error when running it from outside the directory. If I run it on the directory, then it does not detect main_test as a violation of package-directory-mismatch.
Describe the bug
revive's package-directory-mismatch reports a false positive for the usage of the package main_test on the test file main_test.go related to main.go.
To Reproduce
Steps to reproduce the behavior:
go install github.com/mgechev/revive@latestExpected behavior
I expect package main_test to be accepted by revive without throwing a warning.
Logs
revive's output:
myservice/main_test.go:1:9: package name "main_test" does not match directory name "myservice".Desktop (please complete the following information):
Additional context
revive seems to only detect this as an error when running it from outside the directory. If I run it on the directory, then it does not detect main_test as a violation of package-directory-mismatch.