github.com/powerman/golang-tools@v0.1.11-0.20220410185822-5ad214d8d803/godoc/static/package.html (about) 1 <!-- 2 Copyright 2009 The Go Authors. All rights reserved. 3 Use of this source code is governed by a BSD-style 4 license that can be found in the LICENSE file. 5 --> 6 <!-- 7 Note: Static (i.e., not template-generated) href and id 8 attributes start with "pkg-" to make it impossible for 9 them to conflict with generated attributes (some of which 10 correspond to Go identifiers). 11 --> 12 {{with .PDoc}} 13 <script> 14 document.ANALYSIS_DATA = {{$.AnalysisData}}; 15 document.CALLGRAPH = {{$.CallGraph}}; 16 </script> 17 18 {{if $.IsMain}} 19 {{/* command documentation */}} 20 {{comment_html .Doc}} 21 {{else}} 22 {{/* package documentation */}} 23 <div id="short-nav"> 24 <dl> 25 <dd><code>import "{{html .ImportPath}}"</code></dd> 26 </dl> 27 <dl> 28 <dd><a href="#pkg-overview" class="overviewLink">Overview</a></dd> 29 <dd><a href="#pkg-index" class="indexLink">Index</a></dd> 30 {{if $.Examples}} 31 <dd><a href="#pkg-examples" class="examplesLink">Examples</a></dd> 32 {{end}} 33 {{if $.Dirs}} 34 <dd><a href="#pkg-subdirectories">Subdirectories</a></dd> 35 {{end}} 36 </dl> 37 </div> 38 <!-- The package's Name is printed as title by the top-level template --> 39 <div id="pkg-overview" class="toggleVisible"> 40 <div class="collapsed"> 41 <h2 class="toggleButton" title="Click to show Overview section">Overview ▹</h2> 42 </div> 43 <div class="expanded"> 44 <h2 class="toggleButton" title="Click to hide Overview section">Overview ▾</h2> 45 {{comment_html .Doc}} 46 {{example_html $ ""}} 47 </div> 48 </div> 49 50 <div id="pkg-index" class="toggleVisible"> 51 <div class="collapsed"> 52 <h2 class="toggleButton" title="Click to show Index section">Index ▹</h2> 53 </div> 54 <div class="expanded"> 55 <h2 class="toggleButton" title="Click to hide Index section">Index ▾</h2> 56 57 <!-- Table of contents for API; must be named manual-nav to turn off auto nav. --> 58 <div id="manual-nav"> 59 <dl> 60 {{if .Consts}} 61 <dd><a href="#pkg-constants">Constants</a></dd> 62 {{end}} 63 {{if .Vars}} 64 <dd><a href="#pkg-variables">Variables</a></dd> 65 {{end}} 66 {{range .Funcs}} 67 {{$name_html := html .Name}} 68 <dd><a href="#{{$name_html}}">{{node_html $ .Decl false | sanitize}}</a></dd> 69 {{end}} 70 {{range .Types}} 71 {{$tname_html := html .Name}} 72 <dd><a href="#{{$tname_html}}">type {{$tname_html}}</a></dd> 73 {{range .Funcs}} 74 {{$name_html := html .Name}} 75 <dd> <a href="#{{$name_html}}">{{node_html $ .Decl false | sanitize}}</a></dd> 76 {{end}} 77 {{range .Methods}} 78 {{$name_html := html .Name}} 79 <dd> <a href="#{{$tname_html}}.{{$name_html}}">{{node_html $ .Decl false | sanitize}}</a></dd> 80 {{end}} 81 {{end}} 82 {{if $.Notes}} 83 {{range $marker, $item := $.Notes}} 84 <dd><a href="#pkg-note-{{$marker}}">{{noteTitle $marker | html}}s</a></dd> 85 {{end}} 86 {{end}} 87 </dl> 88 </div><!-- #manual-nav --> 89 90 {{if $.Examples}} 91 <div id="pkg-examples"> 92 <h3>Examples</h3> 93 <div class="js-expandAll expandAll collapsed">(Expand All)</div> 94 <dl> 95 {{range $.Examples}} 96 <dd><a class="exampleLink" href="#example_{{.Name}}">{{example_name .Name}}</a></dd> 97 {{end}} 98 </dl> 99 </div> 100 {{end}} 101 102 {{with .Filenames}} 103 <h3>Package files</h3> 104 <p> 105 <span style="font-size:90%"> 106 {{range .}} 107 <a href="{{.|srcLink|html}}">{{.|filename|html}}</a> 108 {{end}} 109 </span> 110 </p> 111 {{end}} 112 </div><!-- .expanded --> 113 </div><!-- #pkg-index --> 114 115 {{if ne $.CallGraph "null"}} 116 <div id="pkg-callgraph" class="toggle" style="display: none"> 117 <div class="collapsed"> 118 <h2 class="toggleButton" title="Click to show Internal Call Graph section">Internal call graph ▹</h2> 119 </div> <!-- .expanded --> 120 <div class="expanded"> 121 <h2 class="toggleButton" title="Click to hide Internal Call Graph section">Internal call graph ▾</h2> 122 <p> 123 In the call graph viewer below, each node 124 is a function belonging to this package 125 and its children are the functions it 126 calls—perhaps dynamically. 127 </p> 128 <p> 129 The root nodes are the entry points of the 130 package: functions that may be called from 131 outside the package. 132 There may be non-exported or anonymous 133 functions among them if they are called 134 dynamically from another package. 135 </p> 136 <p> 137 Click a node to visit that function's source code. 138 From there you can visit its callers by 139 clicking its declaring <code>func</code> 140 token. 141 </p> 142 <p> 143 Functions may be omitted if they were 144 determined to be unreachable in the 145 particular programs or tests that were 146 analyzed. 147 </p> 148 <!-- Zero means show all package entry points. --> 149 <ul style="margin-left: 0.5in" id="callgraph-0" class="treeview"></ul> 150 </div> 151 </div> <!-- #pkg-callgraph --> 152 {{end}} 153 154 {{with .Consts}} 155 <h2 id="pkg-constants">Constants</h2> 156 {{range .}} 157 {{comment_html .Doc}} 158 <pre>{{node_html $ .Decl true}}</pre> 159 {{end}} 160 {{end}} 161 {{with .Vars}} 162 <h2 id="pkg-variables">Variables</h2> 163 {{range .}} 164 {{comment_html .Doc}} 165 <pre>{{node_html $ .Decl true}}</pre> 166 {{end}} 167 {{end}} 168 {{range .Funcs}} 169 {{/* Name is a string - no need for FSet */}} 170 {{$name_html := html .Name}} 171 <h2 id="{{$name_html}}">func <a href="{{posLink_url $ .Decl}}">{{$name_html}}</a> 172 <a class="permalink" href="#{{$name_html}}">¶</a> 173 {{$since := since "func" "" .Name $.PDoc.ImportPath}} 174 {{if $since}}<span title="Added in Go {{$since}}">{{$since}}</span>{{end}} 175 </h2> 176 <pre>{{node_html $ .Decl true}}</pre> 177 {{comment_html .Doc}} 178 {{example_html $ .Name}} 179 {{callgraph_html $ "" .Name}} 180 181 {{end}} 182 {{range .Types}} 183 {{$tname := .Name}} 184 {{$tname_html := html .Name}} 185 <h2 id="{{$tname_html}}">type <a href="{{posLink_url $ .Decl}}">{{$tname_html}}</a> 186 <a class="permalink" href="#{{$tname_html}}">¶</a> 187 {{$since := since "type" "" .Name $.PDoc.ImportPath}} 188 {{if $since}}<span title="Added in Go {{$since}}">{{$since}}</span>{{end}} 189 </h2> 190 {{comment_html .Doc}} 191 <pre>{{node_html $ .Decl true}}</pre> 192 193 {{range .Consts}} 194 {{comment_html .Doc}} 195 <pre>{{node_html $ .Decl true}}</pre> 196 {{end}} 197 198 {{range .Vars}} 199 {{comment_html .Doc}} 200 <pre>{{node_html $ .Decl true}}</pre> 201 {{end}} 202 203 {{example_html $ $tname}} 204 {{implements_html $ $tname}} 205 {{methodset_html $ $tname}} 206 207 {{range .Funcs}} 208 {{$name_html := html .Name}} 209 <h3 id="{{$name_html}}">func <a href="{{posLink_url $ .Decl}}">{{$name_html}}</a> 210 <a class="permalink" href="#{{$name_html}}">¶</a> 211 {{$since := since "func" "" .Name $.PDoc.ImportPath}} 212 {{if $since}}<span title="Added in Go {{$since}}">{{$since}}</span>{{end}} 213 </h3> 214 <pre>{{node_html $ .Decl true}}</pre> 215 {{comment_html .Doc}} 216 {{example_html $ .Name}} 217 {{callgraph_html $ "" .Name}} 218 {{end}} 219 220 {{range .Methods}} 221 {{$name_html := html .Name}} 222 <h3 id="{{$tname_html}}.{{$name_html}}">func ({{html .Recv}}) <a href="{{posLink_url $ .Decl}}">{{$name_html}}</a> 223 <a class="permalink" href="#{{$tname_html}}.{{$name_html}}">¶</a> 224 {{$since := since "method" .Recv .Name $.PDoc.ImportPath}} 225 {{if $since}}<span title="Added in Go {{$since}}">{{$since}}</span>{{end}} 226 </h3> 227 <pre>{{node_html $ .Decl true}}</pre> 228 {{comment_html .Doc}} 229 {{$name := printf "%s_%s" $tname .Name}} 230 {{example_html $ $name}} 231 {{callgraph_html $ .Recv .Name}} 232 {{end}} 233 {{end}} 234 {{end}} 235 236 {{with $.Notes}} 237 {{range $marker, $content := .}} 238 <h2 id="pkg-note-{{$marker}}">{{noteTitle $marker | html}}s</h2> 239 <ul style="list-style: none; padding: 0;"> 240 {{range .}} 241 <li><a href="{{posLink_url $ .}}" style="float: left;">☞</a> {{comment_html .Body}}</li> 242 {{end}} 243 </ul> 244 {{end}} 245 {{end}} 246 {{end}} 247 248 {{with .PAst}} 249 {{range $filename, $ast := .}} 250 <a href="{{$filename|srcLink|html}}">{{$filename|filename|html}}</a>:<pre>{{node_html $ $ast false}}</pre> 251 {{end}} 252 {{end}} 253 254 {{with .Dirs}} 255 {{/* DirList entries are numbers and strings - no need for FSet */}} 256 {{if $.PDoc}} 257 <h2 id="pkg-subdirectories">Subdirectories</h2> 258 {{end}} 259 <div class="pkg-dir"> 260 <table> 261 <tr> 262 <th class="pkg-name">Name</th> 263 <th class="pkg-synopsis">Synopsis</th> 264 </tr> 265 266 {{if not (or (eq $.Dirname "/src/cmd") $.DirFlat)}} 267 <tr> 268 <td colspan="2"><a href="..">..</a></td> 269 </tr> 270 {{end}} 271 272 {{range .List}} 273 <tr> 274 {{if $.DirFlat}} 275 {{if .HasPkg}} 276 <td class="pkg-name"> 277 <a href="{{html .Path}}/{{modeQueryString $.Mode | html}}">{{html .Path}}</a> 278 </td> 279 {{end}} 280 {{else}} 281 <td class="pkg-name" style="padding-left: {{multiply .Depth 20}}px;"> 282 <a href="{{html .Path}}/{{modeQueryString $.Mode | html}}">{{html .Name}}</a> 283 </td> 284 {{end}} 285 <td class="pkg-synopsis"> 286 {{html .Synopsis}} 287 </td> 288 </tr> 289 {{end}} 290 </table> 291 </div> 292 {{end}}