hashstructure icon indicating copy to clipboard operation
hashstructure copied to clipboard

Fix timetype

Open adamhassel opened this issue 3 years ago • 0 comments

This introduces an option, UseBinary, which will use the encoding.MarshalBinary interface of any type implementing it. This fixes hashes of time value for one thing, and expands on the time.Time specific changes from #21 .

Since this could be a breaking change, it is hidden behind a new "UseBinary" option. For types that implement both fmt.Stringer and encoding.MarshalBinary (like time.Time), and when both UseBinary and UseStringer are set, the Binary option is preferred, unless the string tag is specifically set on the struct member.

adamhassel avatar May 16 '22 13:05 adamhassel