Skip to content

feat(testurl): streamline port handling in URL functions 🌐#4

Merged
madflojo merged 1 commit intomainfrom
newstuff
Jun 2, 2025
Merged

feat(testurl): streamline port handling in URL functions 🌐#4
madflojo merged 1 commit intomainfrom
newstuff

Conversation

@madflojo
Copy link
Copy Markdown
Owner

@madflojo madflojo commented Jun 2, 2025

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 for github.com/madflojo/testlazy/things/testurl with Go version 1.24.3.

Code refactoring for maintainability:

  • things/testurl/url.go: Introduced constants HTTPPort and HTTPSPort to replace hardcoded port values in URL generation functions. Updated functions like URLHTTPWithPort, URLHTTPSWithPort, URLHTTPLocalhostWithPort, and URLHTTPSLocalhostWithPort to 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.

Introduced constants for HTTP and HTTPS ports to reduce redundancy. Now the URLs sing the same tune sans repetition!
Copilot AI review requested due to automatic review settings June 2, 2025 00:19
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-commenter
Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (d8274dd) to head (24f7a61).

Additional details and impacted files
@@            Coverage Diff            @@
##              main        #4   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            1         1           
  Lines           52        52           
=========================================
  Hits            52        52           
Flag Coverage Δ
${ matrix.module }-unittests 100.00% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@madflojo madflojo merged commit 732e07e into main Jun 2, 2025
10 checks passed
@madflojo madflojo deleted the newstuff branch June 2, 2025 01:26
@github-actions github-actions bot mentioned this pull request Jun 2, 2025
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.

3 participants