enhancement: improve the equality check #7
Merged
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.
This pull request refactors the implementation of the
Equalmethods for environment variable wrapper types (EnvString,EnvInt,EnvBool,EnvFloat, andEnvAny) 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:
Equalmethods forEnvString,EnvInt,EnvBool,EnvFloat, andEnvAnyto 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:
Equalmethod 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
Equalmethods; this is a code quality and maintainability improvement.