Skip to content

Use fmt.Stringer or encoding.TextMarshaler if possible#19

Open
otaku wants to merge 2 commits into
kr:masterfrom
otaku:master
Open

Use fmt.Stringer or encoding.TextMarshaler if possible#19
otaku wants to merge 2 commits into
kr:masterfrom
otaku:master

Conversation

@otaku

@otaku otaku commented Dec 26, 2014

Copy link
Copy Markdown

An implementation for /issues/16 but also includes fmt.Stringer with priority given to Stringer before TextMarshaler.

I copied /pull/17 test implementation and added two other test cases.

Comment thread formatter.go Outdated

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assign a value on line 172 and I will be typed in each case so this line would reduce to p.fmtString(v.String(), true) and the other case would be simplified similarly.

@otaku

otaku commented Dec 26, 2014

Copy link
Copy Markdown
Author

One thing about this though is this will hide the actual fields, but generally it's helpful in cases such as time.Time. Would it be helpful to add prefix in for these cases?
"&time.Time{(Stringer) "2013-10-01 00:00:00 +0000 UTC"},

@ruzz311

ruzz311 commented Aug 26, 2015

Copy link
Copy Markdown

+1 or can it use GoStringer?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants