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
Does this issue reproduce with the latest release?
arguably no since the latest release, 1.16, does not have this function yet :)
What operating system and processor architecture are you using (go env)?
N/A
What did you do?
Read release notes and corresponding documentation.
What did you expect to see?
Documentation that I understand.
What did you see instead?
Documentation which confused me.
QuotedPrefix returns the quoted string (as understood by Unquote) at the prefix of s. If s does not start with a valid quoted string, QuotedPrefix returns an error.
It is unclear to me whether "as understood by Unquote" means "an initial prefix which Unquote would think was a valid quoted string that it could unquote", or "the result of unquoting such an initial prefix".
For instance, consider the string:
"foo"bar
I would guess that QuotedPrefix, called on this, would yield either "foo" or foo, but i don't know which; both are "the quoted string (as understood by Unquote)". I think the intent is probably "foo", because that seems more likely to be useful -- given the other string, I don't have a way to trim that prefix from the parent string, because I don't know how it looked in the parent string. On the other hand, it seems weird to go to all the trouble of separating it out and parsing it as though unquoting, and not actually do the unquoting, so I don't know.
I feel like QuotedPrefix should probably return (prefix string, remainder string, error). I'm less sure about dequoting; the dequoting operation presumably causes allocation. (It'd be neat, though, to be able to inquire as to the length the dequoted string would have...)
The text was updated successfully, but these errors were encountered:
Example can sometimes be more informative than additional prose.
Fixesgolang#46829
Change-Id: Ia5a5b121ad0b891026e77420d5f7f1b2c4a407da
Reviewed-on: https://go-review.googlesource.com/c/go/+/336749
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: qiulaidongfeng <2645477756@qq.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
What version of Go are you using (
go version
)?1.17 release notes
Does this issue reproduce with the latest release?
arguably no since the latest release, 1.16, does not have this function yet :)
What operating system and processor architecture are you using (
go env
)?N/A
What did you do?
Read release notes and corresponding documentation.
What did you expect to see?
Documentation that I understand.
What did you see instead?
Documentation which confused me.
It is unclear to me whether "as understood by Unquote" means "an initial prefix which Unquote would think was a valid quoted string that it could unquote", or "the result of unquoting such an initial prefix".
For instance, consider the string:
"foo"bar
I would guess that QuotedPrefix, called on this, would yield either
"foo"
orfoo
, but i don't know which; both are "the quoted string (as understood by Unquote)". I think the intent is probably"foo"
, because that seems more likely to be useful -- given the other string, I don't have a way to trim that prefix from the parent string, because I don't know how it looked in the parent string. On the other hand, it seems weird to go to all the trouble of separating it out and parsing it as though unquoting, and not actually do the unquoting, so I don't know.I feel like QuotedPrefix should probably return (prefix string, remainder string, error). I'm less sure about dequoting; the dequoting operation presumably causes allocation. (It'd be neat, though, to be able to inquire as to the length the dequoted string would have...)
The text was updated successfully, but these errors were encountered: