feat: add equal methods #6
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 introduces new equality checking methods for various environment variable wrapper types and adds comprehensive unit tests to ensure their correctness. The changes improve the ability to compare environment configuration values and references, covering both simple and map-based types.
The most important changes are:
Equality methods for environment value types:
Equalmethods toEnvString,EnvInt,EnvBool, andEnvFloattypes to allow comparison of both literal values and environment variable references. [1] [2] [3] [4]Equalmethod to the genericEnvAnytype, usingreflect.DeepEqualfor value comparison.Equality methods for map-based environment value types:
Equalmethods toEnvMapString,EnvMapInt,EnvMapFloat, andEnvMapBool, utilizing the Go 1.21+maps.Equalfunction for map value comparison. [1] [2] [3] [4]mapspackage from the standard library to support map equality checks.Unit testing:
Equalmethods, covering a wide range of cases for each type, in the new filesenvironment_equal_test.goandany_equal_test.go. [1] [2]General improvements:
reflectinany.goto support deep value comparison in theEnvAny.Equalmethod.These changes collectively enhance the reliability and maintainability of code that deals with environment-based configuration by providing consistent equality logic and thorough test coverage.