-
Notifications
You must be signed in to change notification settings - Fork 130
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
exitAfterDefer seems to give a false positive with this code:
package main
import (
"fmt"
"io"
"os"
)
func main() {
items, err := process()
if err != nil {
fmt.Fprintf(os.Stderr, "error: %v\n\n", err)
defer os.Exit(1)
} else {
defer os.Exit(0)
}
fmt.Println("output", items)
}
func process() ([]int, error) { return []int{1, 2, 3}, io.EOF }
Output:
example> gocritic check .
./main.go:15:9: exitAfterDefer: os.Exit clutters `defer os.Exit(1)`
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working