Closed
Description
Your feature request related to a problem? Please describe.
When writing testable examples, the following code is expected:
func ExampleHello() {
fmt.Println("hello")
// Output: hello
}
Or a lowercase output
:
func ExampleHello() {
fmt.Println("hello")
// output: hello
}
However, when writing the following, without an Output
comment:
func ExampleHello() {
fmt.Println("hello")
}
Then the test compiles correctly, but is not picked up by go test
.
We should add a rule which flags when an output
comment is missing.
Describe the solution you'd like.
Add a new rule which flags when a testable example - a test that has the test method prefix Example
- does not contain a comment with an Output:
Describe alternatives you've considered.
This may not be fit to come into golangci-lint per se, but into one of the other linters.
Additional context.
No response