Refactoring
Here are some of the improvements
- Improved error handling: I added proper error handling using log.Fatalf and fmt.Errorf to provide meaningful error messages when encountering errors.
- Removed unnecessary imports: I removed the unused imports to keep the code clean.
- Restructured code: I restructured the code to improve readability and maintainability.
- Added proper log file handling: The log file is opened, closed, and set as the log output within the if condition where the log file name is provided.
- Utilized os.IsNotExist: Instead of using errors.Is(err, os.ErrNotExist), I used os.IsNotExist(err) to check if a file exists.
- Improved struct tags: I added mapstructure tags to the Configurations struct fields to indicate the corresponding keys in the YAML configuration file.
See #4
Edited by Matt Nohr