This pull request introduces enhancements to the decodeTime function in the mapstructure package. The primary objective is to enable the function to handle time values with dynamic formats, providing more flexibility in decoding time representations.
Changes Made:
Modified the decodeTime function to support dynamic time formats.
Updated the test cases in mapstructure_test.go to cover various scenarios, including decoding time.Time, *time.Time, nil *time.Time, and a string representation of time with a dynamic format.
Code Modifications:
Adjustments made to decodeTime function in mapstructure.go to handle dynamic time formats.
Addition of a new test case in mapstructure_test.go to cover the scenario of decoding a string representation of time with a dynamic format.
Test Cases Added:
Decode string time:
Purpose: To ensure that the decodeTime function correctly decodes a string representation of time with a dynamic format.
Input: "2023-11-30T12:34:56Z" (format: RFC3339, but can be any valid format)
Expected Output: No error, and the time value is correctly set in the output.
Testing Approach:
Run existing test cases to ensure that the original functionality remains intact.
Execute the new test case to verify the added support for dynamic time formats.
Manually review the modified code to ensure clarity and adherence to coding standards.
Conduct additional testing with various time formats to validate the flexibility of the updated decodeTime function.
Purpose:
Improve the mapstructure library by allowing users to decode time values with dynamic formats, addressing issues related to fixed-format constraints.
This pull request introduces enhancements to the
decodeTime
function in themapstructure
package. The primary objective is to enable the function to handle time values with dynamic formats, providing more flexibility in decoding time representations.Changes Made:
decodeTime
function to support dynamic time formats.mapstructure_test.go
to cover various scenarios, including decodingtime.Time
,*time.Time
, nil*time.Time
, and a string representation of time with a dynamic format.Code Modifications:
decodeTime
function inmapstructure.go
to handle dynamic time formats.mapstructure_test.go
to cover the scenario of decoding a string representation of time with a dynamic format.Test Cases Added:
decodeTime
function correctly decodes a string representation of time with a dynamic format."2023-11-30T12:34:56Z"
(format: RFC3339, but can be any valid format)Testing Approach:
decodeTime
function.Purpose:
mapstructure
library by allowing users to decode time values with dynamic formats, addressing issues related to fixed-format constraints.