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
You are calling fmt.Printf, which tries to interpret the % in the string. The string is, in fact, what you expect it to be, but your code is going about printing it in the wrong way: https://play.golang.org/p/eoj7Bc5_MX1
What @acln0 said. But also, you're calling fmt.Errorf with the first argument (the format) having a bogus format with percent signs. Use errors.New if you just want an error from a string (without a format).
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes.
What did you do?
fmt.Sprintf of a variable that contain the "%" character.
Here is a link to play.golang.org reproducing the issue: play.golang.org
What did you expect to see?
Let's say I have a string named str and set to "0%{?dist}".
Such as fmt.Printf, I expect to see something like:
What did you see instead?
Sprintf does not seem to handle "%" character like Printf does.
Indeed, here is what Sprintf returns:
Errorf function has the same behavior with "%" character than Sprintf, but I guess this is because Errorf uses Sprintf.
Thank you !
The text was updated successfully, but these errors were encountered: