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
I would expect to see errors from fmt complaining about invalid format strings, or a literal representation of the string without the formatting applied, or the space simply be ignored. Instead, the formatting is applied in an inconsistent way.
The text was updated successfully, but these errors were encountered:
mikioh
changed the title
fmt exhibits strange behaviour when format strings contain spaces
fmt: exhibits strange behaviour when format strings contain spaces
Oct 13, 2016
Note that space is a valid and documented flag character. The docs say leave a space for elided sign in numbers (% d); put spaces between bytes printing strings or slices in hex (% x, % X)".
I think the output shown above is correct, so I'm going to close this.
It seems that when spaces are inserted in a format string like %#v, some slightly surprising formatting occurs.
What version of Go are you using (
go version
)?Go 1.7.1 (on the Go playground)
What operating system and processor architecture are you using (
go env
)?The Go playground.
What did you do?
https://play.golang.org/p/2jeholpKdb
What did you expect to see?
I would expect to see errors from fmt complaining about invalid format strings, or a literal representation of the string without the formatting applied, or the space simply be ignored. Instead, the formatting is applied in an inconsistent way.
What did you see instead?
The text was updated successfully, but these errors were encountered: