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
funcmain() {
n, ok:=parseNumber([]byte("1234,anything can come after the comma"))
ifok {
panic(fmt.Sprintf("should not be ok, %d", n))
}
}
panics with should not be ok, 4, indicating that it parsed "1234,anything can come after the comma" into the integer 1234, even though this should really throw an error.
What did you expect to see?
ok == false
What did you see instead?
ok == true
Anything else we should know about your project / environment?
No
The text was updated successfully, but these errors were encountered:
The parseNumber function is internal to the package and only parses a JSON number out of the front of the input. Is this somehow resulting in a bug in the observable API for protojson?
Thanks, I recommend next time filing the buggy observed behavior rather than pointing at a particular internal function. The behavior of parseNumber is correct. I suspect the problem is actually parseNumberParts, which should probably reject trailing data since it's only called from the context of a standalone token.
What version of protobuf and what language are you using?
Version: master, Go
What did you do?
With the parseNumber function:
panics with
should not be ok, 4
, indicating that it parsed"1234,anything can come after the comma"
into the integer1234
, even though this should really throw an error.What did you expect to see?
ok == false
What did you see instead?
ok == true
Anything else we should know about your project / environment?
No
The text was updated successfully, but these errors were encountered: