Conversation
Introduced constants for HTTP and HTTPS ports to reduce redundancy. Now the URLs sing the same tune sans repetition!
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR streamlines port handling in URL functions by replacing hardcoded port values with constants, refactoring the URL generation logic, and cleaning up redundant documentation.
- Introduced constants HTTPPort and HTTPSPort to centralize port definitions.
- Refactored URL functions (e.g., URLHTTPWithPort, URLHTTPSWithPort, etc.) to use the new constants.
- Removed redundant documentation to simplify the file.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| things/testurl/go.mod | Added new Go module definition with updated Go version. |
| things/testurl/url.go | Refactored URL functions to use constants; cleaned up redundant comments. |
Comments suppressed due to low confidence (1)
things/testurl/url.go:67
- [nitpick] Update the function comment for URLHTTPWithPort to reference the HTTPPort constant rather than the hardcoded value '8080', ensuring that documentation remains consistent with the implementation.
func URLHTTPWithPort() *url.URL {
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #4 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 1 1
Lines 52 52
=========================================
Hits 52 52
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Introduced constants for HTTP and HTTPS ports to reduce redundancy. Now the URLs sing the same tune sans repetition!
This pull request introduces a new Go module for URL handling and refactors the code to improve maintainability by using constants for port definitions. Additionally, some redundant documentation has been removed to streamline the codebase.
New module creation:
things/testurl/go.mod: Added a new Go module definition forgithub.com/madflojo/testlazy/things/testurlwith Go version1.24.3.Code refactoring for maintainability:
things/testurl/url.go: Introduced constantsHTTPPortandHTTPSPortto replace hardcoded port values in URL generation functions. Updated functions likeURLHTTPWithPort,URLHTTPSWithPort,URLHTTPLocalhostWithPort, andURLHTTPSLocalhostWithPortto use these constants. [1] [2] [3]Documentation cleanup:
things/testurl/url.go: Removed redundant documentation describing HTTP vs HTTPS, ports, paths, queries, and fragments to simplify the file.