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: Refactor static file server handler and logger #8

Merged
merged 1 commit into from
Oct 4, 2024

Conversation

jrschumacher
Copy link
Owner

Refactor the code in staticFileServerHandler.go and logger.go to improve code organization and readability. The changes include:

  • Move the logger related functions to a separate file, logger.go, for better separation of concerns.
  • Rename the StaticFilesHandler function to NewStaticFilesHandler to follow the Go convention for constructor functions.
  • Extract the ServeHTTP method from the StaticFilesHandler function and move it to the StaticFilesHandler struct to improve encapsulation.
  • Clean up the code by removing unused imports and variables.

This commit improves the maintainability and readability of the codebase.

Refactor the code in staticFileServerHandler.go and logger.go to improve code organization and readability. The changes include:
- Move the logger related functions to a separate file, logger.go, for better separation of concerns.
- Rename the StaticFilesHandler function to NewStaticFilesHandler to follow the Go convention for constructor functions.
- Extract the ServeHTTP method from the StaticFilesHandler function and move it to the StaticFilesHandler struct to improve encapsulation.
- Clean up the code by removing unused imports and variables.

This commit improves the maintainability and readability of the codebase.
Copy link

codecov bot commented Oct 4, 2024

Codecov Report

Attention: Patch coverage is 86.84211% with 5 lines in your changes missing coverage. Please review.

Project coverage is 83.13%. Comparing base (b5d1de7) to head (b111580).
Report is 2 commits behind head on main.

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
staticFileServerHandler.go 84.37% 3 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main       #8      +/-   ##
==========================================
+ Coverage   80.98%   83.13%   +2.15%     
==========================================
  Files           3        4       +1     
  Lines         163      166       +3     
==========================================
+ Hits          132      138       +6     
+ Misses         18       15       -3     
  Partials       13       13              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jrschumacher jrschumacher merged commit fe7c839 into main Oct 4, 2024
3 checks passed
@jrschumacher jrschumacher deleted the refactor-static-file-server branch October 4, 2024 20:20
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.

1 participant