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

Should exit with a non-zero error code on fatal error #70

Merged
merged 1 commit into from
May 19, 2022

Conversation

growse
Copy link
Contributor

@growse growse commented May 19, 2022

Currently there's a bunch of different conditions in func main() which cause an immediate return (exit) because of an error that was encountered. On golang, returning the main function causes the program to exit status code 0 (success). Rather than indicate success, failures should exit with a non-zero code so that process managers can recognise it as a failure and do something appropriate (e.g. restart if the error condition is transient).

Currently there's a bunch of different conditions in `func main()` which cause an immediate `return` (exit) because of an error that was encountered. On golang, returning the main function causes the program to exit status code 0 (success). Rather than indicate success, failures should exit with a non-zero code so that process managers can recognise it as a failure and do something appropriate (e.g. restart if the error condition is transient).

Signed-off-by: Andrew Rowson <[email protected]>
Copy link
Owner

@SuperQ SuperQ left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense, thanks!

@SuperQ SuperQ merged commit 9116bb2 into SuperQ:master May 19, 2022
@growse growse deleted the patch-1 branch May 19, 2022 21:07
SuperQ added a commit that referenced this pull request May 23, 2022
* [CHANGE] Exit with a non-zero error code on fatal error #70
* [FEATURE] Add TLS/Auth from exporter-toolkit #69

Misc:
* Update build to Go 1.18.
* Bump Go modules.
* Enable dependabot.
* Sync upstream Prometheus Makefile.common.

Signed-off-by: SuperQ <[email protected]>
@SuperQ SuperQ mentioned this pull request May 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants