mirror of https://github.com/golang/go.git
Allows Examples with KeyValue expressions to be playable in godoc.
During the traversal of the abstract syntax tree any KeyValueExpr Key.Name was incorrectly being added as an unresolved identifier.
Since this identifier could not be provided the Example was marked as unplayable.
This updates the AST traversal to skip Keys (but continue traversing the Values).
Example of problematic AST now fixed (see L99 where "UpperBound" was being added as a missing identifier):
81 . . . . . . . . . Values: []ast.Expr (len = 1) {
82 . . . . . . . . . . 0: *ast.UnaryExpr {
83 . . . . . . . . . . . OpPos: 12:19
84 . . . . . . . . . . . Op: &
85 . . . . . . . . . . . X: *ast.CompositeLit {
86 . . . . . . . . . . . . Type: *ast.SelectorExpr {
87 . . . . . . . . . . . . . X: *ast.Ident {
88 . . . . . . . . . . . . . . NamePos: 12:20
89 . . . . . . . . . . . . . . Name: "t_proto"
90 . . . . . . . . . . . . . }
91 . . . . . . . . . . . . . Sel: *ast.Ident {
92 . . . . . . . . . . . . . . NamePos: 12:41
93 . . . . . . . . . . . . . . Name: "BConfig"
94 . . . . . . . . . . . . . }
95 . . . . . . . . . . . . }
96 . . . . . . . . . . . . Lbrace: 12:79
97 . . . . . . . . . . . . Elts: []ast.Expr (len = 2) {
98 . . . . . . . . . . . . . 0: *ast.KeyValueExpr {
99 . . . . . . . . . . . . . . Key: *ast.Ident {
100 . . . . . . . . . . . . . . . NamePos: 13:3
101 . . . . . . . . . . . . . . . Name: "UpperBound"
102 . . . . . . . . . . . . . . }
103 . . . . . . . . . . . . . . Colon: 13:13
104 . . . . . . . . . . . . . . Value: *ast.CallExpr {
105 . . . . . . . . . . . . . . . Fun: *ast.SelectorExpr {
106 . . . . . . . . . . . . . . . . X: *ast.Ident {
107 . . . . . . . . . . . . . . . . . NamePos: 13:15
108 . . . . . . . . . . . . . . . . . Name: "proto"
109 . . . . . . . . . . . . . . . . }
110 . . . . . . . . . . . . . . . . Sel: *ast.Ident {
111 . . . . . . . . . . . . . . . . . NamePos: 13:21
112 . . . . . . . . . . . . . . . . . Name: "Float32"
113 . . . . . . . . . . . . . . . . }
R=adg
CC=gobot, golang-dev, gri
https://golang.org/cl/8569045
|
||
|---|---|---|
| api | ||
| doc | ||
| include | ||
| lib | ||
| misc | ||
| src | ||
| test | ||
| .hgignore | ||
| .hgtags | ||
| AUTHORS | ||
| CONTRIBUTORS | ||
| LICENSE | ||
| PATENTS | ||
| README | ||
| favicon.ico | ||
| robots.txt | ||
README
This is the source code repository for the Go programming language.
For documentation about how to install and use Go,
visit http://golang.org/ or load doc/install.html in your web browser.
After installing Go, you can view a nicely formatted
doc/install.html by running godoc --http=:6060
and then visiting http://localhost:6060/doc/install.html.
Unless otherwise noted, the Go source files are distributed
under the BSD-style license found in the LICENSE file.
--
Binary Distribution Notes
If you have just untarred a binary Go distribution, you need to set
the environment variable $GOROOT to the full path of the go
directory (the one containing this README). You can omit the
variable if you unpack it into /usr/local/go, or if you rebuild
from sources by running all.bash (see doc/install.html).
You should also add the Go binary directory $GOROOT/bin
to your shell's path.
For example, if you extracted the tar file into $HOME/go, you might
put the following in your .profile:
export GOROOT=$HOME/go
export PATH=$PATH:$GOROOT/bin
See doc/install.html for more details.