mirror of
https://github.com/golang/go
synced 2024-11-19 02:34:44 -07:00
2ca2bfc172
Fix output of packages with multiple files. Remove extra output when filter is requested. Fixes golang/go#7115. R=bradfitz, adg CC=golang-codereviews https://golang.org/cl/52750044
86 lines
2.2 KiB
Plaintext
86 lines
2.2 KiB
Plaintext
{{$info := .}}{{$filtered := .IsFiltered}}{{/*
|
|
|
|
---------------------------------------
|
|
|
|
*/}}{{if $filtered}}{{range .PAst}}{{range .Decls}}{{node $info .}}{{end}}{{end}}{{else}}{{with .PAst}}{{range $filename, $ast := .}}{{$filename}}:
|
|
{{node $ $ast}}{{end}}{{end}}{{end}}{{/*
|
|
|
|
---------------------------------------
|
|
|
|
*/}}{{with .PDoc}}{{if $.IsMain}}COMMAND DOCUMENTATION
|
|
|
|
{{comment_text .Doc " " "\t"}}
|
|
{{else}}{{if not $filtered}}PACKAGE DOCUMENTATION
|
|
|
|
package {{.Name}}
|
|
import "{{.ImportPath}}"
|
|
|
|
{{comment_text .Doc " " "\t"}}
|
|
{{example_text $ "" " "}}{{end}}{{/*
|
|
|
|
---------------------------------------
|
|
|
|
*/}}{{with .Consts}}{{if not $filtered}}
|
|
CONSTANTS
|
|
|
|
{{end}}{{range .}}{{node $ .Decl}}
|
|
{{comment_text .Doc " " "\t"}}
|
|
{{end}}{{end}}{{/*
|
|
|
|
---------------------------------------
|
|
|
|
*/}}{{with .Vars}}{{if not $filtered}}
|
|
VARIABLES
|
|
|
|
{{end}}{{range .}}{{node $ .Decl}}
|
|
{{comment_text .Doc " " "\t"}}
|
|
{{end}}{{end}}{{/*
|
|
|
|
---------------------------------------
|
|
|
|
*/}}{{with .Funcs}}{{if not $filtered}}
|
|
FUNCTIONS
|
|
|
|
{{end}}{{range .}}{{node $ .Decl}}
|
|
{{comment_text .Doc " " "\t"}}
|
|
{{example_text $ .Name " "}}{{end}}{{end}}{{/*
|
|
|
|
---------------------------------------
|
|
|
|
*/}}{{with .Types}}{{if not $filtered}}
|
|
TYPES
|
|
|
|
{{end}}{{range .}}{{$tname := .Name}}{{node $ .Decl}}
|
|
{{comment_text .Doc " " "\t"}}
|
|
{{range .Consts}}{{node $ .Decl}}
|
|
{{comment_text .Doc " " "\t"}}
|
|
{{end}}{{range .Vars}}{{node $ .Decl}}
|
|
{{comment_text .Doc " " "\t"}}
|
|
{{end}}{{example_text $ .Name " "}}
|
|
{{range .Funcs}}{{node $ .Decl}}
|
|
{{comment_text .Doc " " "\t"}}
|
|
{{example_text $ .Name " "}}
|
|
{{end}}{{range .Methods}}{{node $ .Decl}}
|
|
{{comment_text .Doc " " "\t"}}
|
|
{{$name := printf "%s_%s" $tname .Name}}{{example_text $ $name " "}}{{end}}
|
|
{{end}}{{end}}{{end}}{{/*
|
|
|
|
---------------------------------------
|
|
|
|
*/}}{{with $.Notes}}
|
|
{{range $marker, $content := .}}
|
|
{{$marker}}S
|
|
|
|
{{range $content}}{{comment_text .Body " " "\t"}}
|
|
{{end}}{{end}}{{end}}{{end}}{{/*
|
|
|
|
---------------------------------------
|
|
|
|
*/}}{{with .Dirs}}
|
|
SUBDIRECTORIES
|
|
{{if $.DirFlat}}{{range .List}}{{if .HasPkg}}
|
|
{{.Path}}{{end}}{{end}}
|
|
{{else}}{{range .List}}
|
|
{{repeat `. ` .Depth}}{{.Name}}{{end}}
|
|
{{end}}{{end}}
|