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
The behavior is strongly dependent on the input values.
According to documentation, the verb %q produces "a single-quoted character literal safely escaped with Go syntax.".
It is not clear for which input values %q returns an escaped Unicode character \u[0-9a-f]+, \U[0-9a-f]+, or "a single-quoted character literal safely escaped with Go syntax.".
It is not reasonable that different input values (i <> j) have the same output (u == v).
The text was updated successfully, but these errors were encountered:
It seems to me the property that for any Integer input (%q is listed for Integers) "a single quoted character literal" is met in the example. '\ufffd' seems to be a single quoted character literal containing a single Unicode character (here it is the unicode.ReplacementChar https://golang.org/pkg/unicode/#pkg-constants).
If this is about larger or negative inputs then an issue already exists about this. I dont think bad verb behaviour should be triggered based on value range: #14569
If this is the issue I would suggest to close this issue as a duplicate and the discussion can continue on the older issue.
I think its reasonable for different input values to have the same output in form of the unicode.ReplacementChar because not all integers can be mapped to different valid unicode characters and therefore single quoted characters with valid encoding in a character literal.
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes.
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
For readability I use
%+q
instead of%q
. The behavior is the same.https://play.golang.org/p/Mrx55HYohK_u
What did you expect to see?
55555 55556 false %!q(int=+55555) %!q(int=+55556) false
What did you see instead?
55555 55556 false '\ufffd' '\ufffd' true
The behavior is strongly dependent on the input values.
According to documentation, the verb
%q
produces "a single-quoted character literal safely escaped with Go syntax.".\u[0-9a-f]+
,\U[0-9a-f]+
, or "a single-quoted character literal safely escaped with Go syntax.".i <> j
) have the same output (u == v
).The text was updated successfully, but these errors were encountered: