Skip to content

Conversation

@hgiasac
Copy link
Collaborator

@hgiasac hgiasac commented Dec 13, 2025

This pull request refactors the implementation of the Equal methods for environment variable wrapper types (EnvString, EnvInt, EnvBool, EnvFloat, and EnvAny) to improve clarity and maintainability. Additionally, it consolidates and relocates their unit tests into the main test files, removing redundant test files.

Refactoring of equality logic:

  • Simplified the Equal methods for EnvString, EnvInt, EnvBool, EnvFloat, and EnvAny to return early if values differ, making the logic clearer and more efficient. The methods now check for value equality first and only compare variable names if values match. (environment.go [1] [2] [3] [4]; any.go [5]

Test consolidation and cleanup:

  • Moved all Equal method tests for the environment types from their dedicated test files (environment_equal_test.go, any_equal_test.go) into the main test files (environment_test.go, any_test.go), and deleted the now-redundant test files. This improves test organization and reduces duplication. (environment_equal_test.go [1] any_equal_test.go [2] environment_test.go [3] any_test.go [4]

No functional changes were made to the behavior of the Equal methods; this is a code quality and maintainability improvement.

@hgiasac hgiasac merged commit 53fe8c9 into main Dec 13, 2025
1 check passed
@hgiasac hgiasac deleted the fix/early-return-equal branch December 13, 2025 03:06
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