fmt.Formatter and '%w'

73 views
Skip to first unread message

simon place

unread,
Oct 27, 2022, 7:20:36 PM10/27/22
to golang-nuts
you can use the fmt.Formatter interface to make your own 'verbs', makes sense as expected, except for 'w' where you just get the error:

>   fmt.Printf format %w has arg ??? of wrong type

seems trying to make your own formatting for the verb 'w' is blocked, presumably because it checks for an implementer of the Error interface before checking for the fmt.Formatter interface, seems inconsistent and unfortunate. maybe a bug?

Reply all
Reply to author
Forward
0 new messages