k0kubun/pp

Option to format time.Time

dennypenta opened this issue · 1 comments

The problem:
I have a struct with a bunch of populated fields.
I want to print the struct in order to use it in my unit test as data input and not to describe it manually.

The library fits it well, but a few formatting options are missing.

The solution
Add an optional formatting for fields like time.Time and may be the others, instead of raw string value I would like to see:

time.Date(1, 2, 3, 5, 6, 7, time.Local)

Any questions/concerns regarding the feature?

The logic to format time.Date(1, 2, 3, 5, 6, 7, time.Local) is implemented by the user and not in the pp side, right? Then I'm open to merging a pull request that adds such a customization capability, assuming the patch would not be too complicated.