You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
%#v formats the argument as "a Go-syntax representation of the value". A stringer does not produce such a representation. Use %v if you want to invoke a stringer.
Forgot about GoString(), that's what I was looking for. testify uses %#v to produce messages for assert.Equal, which is lousy for enums. But now I have an easy way to fix it. Thanks.
mikioh
changed the title
Printf %#v doesn't consider String() methods of types
fmt: Printf %#v doesn't consider String() methods of types
Feb 5, 2015
I ran into this with an enum type: http://play.golang.org/p/rK_gIV72ea
But itemType defines a String() method which, were it used, would make the Printf a lot more readable. Wasn't String() designed for Printf?
Is there a reason this can't or shouldn't be done? If not I would like to create and contribute a patch.
The text was updated successfully, but these errors were encountered: