8000 Suggestion: unreachable code for functions like os.Exit · Issue #1680 · dominikh/go-tools · GitHub
[go: up one dir, main page]

Skip to content

Suggestion: unreachable code for functions like os.Exit #1680

Open

Description

@podocarp

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

  1. added
    needs-decisionWe have to decide if this check is feasible and desirable
    and removed
    needs-triageNewly filed issue that needs triage
    on Dec 30, 2025
  2. IlyasYOY commented on Feb 7, 2026

    @IlyasYOY

    @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 defer won't be executed in this case. I see this bug way too often.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs-decisionWe have to decide if this check is feasible and desirable

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      0