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

Remove calls to logrus.Fatal() and panic() in library components #57

Merged
merged 1 commit into from
Feb 17, 2024

Conversation

dismantl
Copy link
Contributor

I use the ligolo-ng library packages in my own application, and noticed when attempting to listen on a port that was already in use, instead of returning an error the whole program would exit due to a call to logrus.Fatal. According to Go best practices, libraries should avoid exposing panics and prefer to log/return errors when possible (and I would say this extends to functions like logrus.Fatal), so that's what this PR attempts to do. It also adds a check to make sure port 80 is available before starting a web server for Let's Encrypt cert generation.

Thanks for all your work on ligolo-ng, it is a fantastic tool!

…h logging and returning errors. Controller.WaitForReady() now returns an error if one occurs during ListenAndServe().
@nicocha30 nicocha30 merged commit 4a472cc into nicocha30:master Feb 17, 2024
@nicocha30
Copy link
Owner

Lgtm! Thanks @dismantl

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