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: Daniel Martí <mvdan@mvdan.cc>
diff --git a/src/go/ast/ast.go b/src/go/ast/ast.go
index 81c6458..1061f1d 100644
--- a/src/go/ast/ast.go
+++ b/src/go/ast/ast.go
@@ -285,6 +285,12 @@
 	}
 
 	// A BasicLit node represents a literal of basic type.
+	//
+	// Note that for the CHAR and STRING kinds, the literal is stored
+	// with its quotes. For example, for a double-quoted STRING, the
+	// first and the last rune in the Value field will be ". The
+	// Unquote and UnquoteChar functions in the strconv package can be
+	// used to unquote STRING and CHAR values, respectively.
 	BasicLit struct {
 		ValuePos token.Pos   // literal position
 		Kind     token.Token // token.INT, token.FLOAT, token.IMAG, token.CHAR, or token.STRING