Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

proposal: x/tools/cmd/deadcode: Notify OS of exit code 2,1 when unreachable code is found #66027

Closed
Hyuga-Tsukui opened this issue Feb 29, 2024 · 3 comments

Comments

@Hyuga-Tsukui
Copy link

Hyuga-Tsukui commented Feb 29, 2024

Proposal Details

The deadcode command is quite useful but not well-suited for execution in automated environments such as CI. This is because, even when it discovers unreachable code, it only outputs the list of findings to standard error without sending an exit code.

In this proposal, I suggest properly implementing exit notifications to the OS for the deadcode command, motivated by its usage scenarios.

The implementation could be straightforward: at the end of the main function, simply call os.Exit(2) if the length of the output list of unreachable code is greater than zero.

@gopherbot gopherbot added this to the Proposal milestone Feb 29, 2024
@Hyuga-Tsukui Hyuga-Tsukui changed the title proposal: x/tools/cmd/deadcode: Notify OS of exit code 2 when unreachable code is found proposal: x/tools/cmd/deadcode: Notify OS of exit code 2,1 when unreachable code is found Feb 29, 2024
@gopherbot
Copy link
Contributor

Change https://go.dev/cl/568175 mentions this issue: cmd/deadcode: return an end code.

@mauri870
Copy link
Member

Thanks for opening a proposal. We already discussed this previously in issue #64713.

I don't think anything changed regarding the decision that was taken there, so I'm marking this as a duplicate.

@mauri870
Copy link
Member

Duplicate of #64713.

@mauri870 mauri870 closed this as not planned Won't fix, can't repro, duplicate, stale Feb 29, 2024
@golang golang locked and limited conversation to collaborators Feb 28, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants