Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

strconv: Document that Unquote("''") doesn't return error #64280

Open
johannes-riecken opened this issue Nov 20, 2023 · 1 comment · May be fixed by #68524
Open

strconv: Document that Unquote("''") doesn't return error #64280

johannes-riecken opened this issue Nov 20, 2023 · 1 comment · May be fixed by #68524
Assignees
Labels
Documentation NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@johannes-riecken
Copy link

What version of Go are you using (go version)?

$ go version
go version go1.21.4 darwin/arm64

The documentation for strconv.Unquote currently reads

package strconv // import "strconv"

func Unquote(s string) (string, error)
Unquote interprets s as a single-quoted, double-quoted, or backquoted
Go string literal, returning the string value that s quotes. (If s is
single-quoted, it would be a Go character literal; Unquote returns the
corresponding one-character string.)

However, strconv.Unquote("''") equals the empty string, whereas from the documentation one would assume this to return an invalid-syntax error. Perhaps a reasonable addition to the documentation would be

If s is an empty pair of single quotes, Unquote returns the empty string.

@mknyszek mknyszek added NeedsFix The path to resolution is known, but the work has not been done. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. labels Nov 20, 2023
@mknyszek mknyszek added this to the Backlog milestone Nov 20, 2023
@mknyszek mknyszek added help wanted and removed NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. labels Nov 20, 2023
@mknyszek mknyszek self-assigned this Nov 20, 2023
@gopherbot
Copy link
Contributor

Change https://go.dev/cl/599575 mentions this issue: src/strconv: Update quote.go

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Documentation NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants