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

Fix Error Handling and Resource Leak in path.go and root.go #52

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

gopkg-dev
Copy link

This pull request addresses two issues:

In path.go, replace logrus.Fatal with logrus.Fatalf to format error messages accurately.
In root.go, add a conditional defer statement to ensure proper file closure after successful creation.
These changes improve error handling and prevent resource leaks in the codebase.

…ssage

fix(root.go): add defer f.Close() to ensure file is closed after writing
The logrus.Fatal function is changed to logrus.Fatalf in order to format the error message with the error string. This provides more detailed information about the error when logging. In root.go, a defer statement is added to ensure that the file is closed after writing. This prevents resource leaks and ensures proper cleanup.
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.

None yet

1 participant