Commit 5cc030aa authored by Alberto Donizetti's avatar Alberto Donizetti
Browse files

go/ast: note that in BasicLit CHARs and STRINGs are quoted

The Value field of ast.BasicLit is a string field holding the literal
string. For CHARs and STRINGs, the BasicLit.Value literal includes
quotes, so to use the value in practise one will often need to Unquote
it.

Since this is a common gotcha (I've been bitten by this a few times),
document it, and suggest the use of the strconv.Unquote functions.

Fixes #39590

Change-Id: Ie3e13f5a2a71bb1b59e03bc5b3a16d8e2e7c01d4
Reviewed-on: https://go-review.googlesource.com/c/go/+/244960


Reviewed-by: default avatarDaniel Martí <mvdan@mvdan.cc>
parent 617f2c3e
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment