campeon23 / split-fetcher

The code is a concurrent file downloader in Go that splits a file into multiple parts, downloads them in parallel, and assembles the final file, with support for Etag validation to ensure file integrity.
MIT License
1 stars 0 forks source link

Use of Global Variables #112

Closed campeon23 closed 1 year ago

campeon23 commented 1 year ago
  • Package Name: main
  • Function Name: N/A (Package level)
  • Line Code: 19-40

Description: There are a large number of global variables. While this is not always a problem, it can lead to hard-to-maintain code, especially in larger projects. Consider structuring the application in a more object-oriented way. Severity: Low

campeon23 commented 1 year ago

Resolution:
In response to the highlighted concern, the configuration management has been refactored to revolve around the AppConfig structure. This design leverages the object-oriented paradigm, allowing AppConfig to manage its own state, and offers methods for interacting with this state. Key methods introduced are:

The refactoring encapsulates the responsibilities related to configuration within a dedicated structure, thereby enhancing the code's intuitiveness, scalability, and maintainability.

Commit Reference:
Refactored the configuration management to center around the AppConfig structure, leading to a more structured and organized codebase.