You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Suggestion: unreachable code for functions like os.Exit #1680
We already have unreachable code warnings e.g. for code after return statments or infinite for loops.
I realised we currently don't have anything for functions like os.Exit, log.Fatal{,f,ln} etc. and there are probably a few more that I missed.
Activity
IlyasYOY commentedon Feb 7, 2026
@podocarp Hey! This is an awesome idea. Especially due to this fact not being obvious to the newcomers.
I tried to find a good place to put it in this repo, but didn't find any. But I found the analyzer in golang's tools: https://pkg.go.dev/golang.org/x/tools/go/analysis/passes/unreachable. What do you think?
PS. Also, this would be great to highlight that
deferwon't be executed in this case. I see this bug way too often.