You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

337 lines
11 KiB

  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 type='text/javascript'>
  14. document.ANALYSIS_DATA = {{$.AnalysisData}};
  15. document.CALLGRAPH = {{$.CallGraph}};
  16. </script>
  17. {{if $.IsMain}}
  18. {{/* command documentation */}}
  19. {{comment_html .Doc}}
  20. {{else}}
  21. {{/* package documentation */}}
  22. <div id="short-nav">
  23. <dl>
  24. <dd><code>import "{{html .ImportPath}}"</code></dd>
  25. </dl>
  26. <dl>
  27. <dd><a href="#pkg-overview" class="overviewLink">Overview</a></dd>
  28. <dd><a href="#pkg-index" class="indexLink">Index</a></dd>
  29. {{if $.Examples}}
  30. <dd><a href="#pkg-examples" class="examplesLink">Examples</a></dd>
  31. {{end}}
  32. {{if $.Dirs}}
  33. <dd><a href="#pkg-subdirectories">Subdirectories</a></dd>
  34. {{end}}
  35. </dl>
  36. </div>
  37. <!-- The package's Name is printed as title by the top-level template -->
  38. <div id="pkg-overview" class="toggleVisible">
  39. <div class="collapsed">
  40. <h2 class="toggleButton" title="Click to show Overview section">Overview ▹</h2>
  41. </div>
  42. <div class="expanded">
  43. <h2 class="toggleButton" title="Click to hide Overview section">Overview ▾</h2>
  44. {{comment_html .Doc}}
  45. </div>
  46. </div>
  47. {{example_html $ ""}}
  48. <div id="pkg-index" class="toggleVisible">
  49. <div class="collapsed">
  50. <h2 class="toggleButton" title="Click to show Index section">Index ▹</h2>
  51. </div>
  52. <div class="expanded">
  53. <h2 class="toggleButton" title="Click to hide Index section">Index ▾</h2>
  54. <!-- Table of contents for API; must be named manual-nav to turn off auto nav. -->
  55. <div id="manual-nav">
  56. <dl>
  57. {{if .Consts}}
  58. <dd><a href="#pkg-constants">Constants</a></dd>
  59. {{end}}
  60. {{if .Vars}}
  61. <dd><a href="#pkg-variables">Variables</a></dd>
  62. {{end}}
  63. {{range .Funcs}}
  64. {{$name_html := html .Name}}
  65. <dd><a href="#{{$name_html}}">{{node_html $ .Decl false | sanitize}}</a></dd>
  66. {{end}}
  67. {{range .Types}}
  68. {{$tname_html := html .Name}}
  69. <dd><a href="#{{$tname_html}}">type {{$tname_html}}</a></dd>
  70. {{range .Funcs}}
  71. {{$name_html := html .Name}}
  72. <dd>&nbsp; &nbsp; <a href="#{{$name_html}}">{{node_html $ .Decl false | sanitize}}</a></dd>
  73. {{end}}
  74. {{range .Methods}}
  75. {{$name_html := html .Name}}
  76. <dd>&nbsp; &nbsp; <a href="#{{$tname_html}}.{{$name_html}}">{{node_html $ .Decl false | sanitize}}</a></dd>
  77. {{end}}
  78. {{end}}
  79. {{if $.Notes}}
  80. {{range $marker, $item := $.Notes}}
  81. <dd><a href="#pkg-note-{{$marker}}">{{noteTitle $marker | html}}s</a></dd>
  82. {{end}}
  83. {{end}}
  84. </dl>
  85. </div><!-- #manual-nav -->
  86. {{if $.Examples}}
  87. <div id="pkg-examples">
  88. <h3>Examples</h3>
  89. <dl>
  90. {{range $.Examples}}
  91. <dd><a class="exampleLink" href="#example_{{.Name}}">{{example_name .Name}}</a></dd>
  92. {{end}}
  93. </dl>
  94. </div>
  95. {{end}}
  96. {{with .Filenames}}
  97. <h3>Package files</h3>
  98. <p>
  99. <span style="font-size:90%">
  100. {{range .}}
  101. <a href="{{.|srcLink|html}}">{{.|filename|html}}</a>
  102. {{end}}
  103. </span>
  104. </p>
  105. {{end}}
  106. </div><!-- .expanded -->
  107. </div><!-- #pkg-index -->
  108. <div id="pkg-callgraph" class="toggle" style="display: none">
  109. <div class="collapsed">
  110. <h2 class="toggleButton" title="Click to show Internal Call Graph section">Internal call graph ▹</h2>
  111. </div> <!-- .expanded -->
  112. <div class="expanded">
  113. <h2 class="toggleButton" title="Click to hide Internal Call Graph section">Internal call graph ▾</h2>
  114. <p>
  115. In the call graph viewer below, each node
  116. is a function belonging to this package
  117. and its children are the functions it
  118. calls&mdash;perhaps dynamically.
  119. </p>
  120. <p>
  121. The root nodes are the entry points of the
  122. package: functions that may be called from
  123. outside the package.
  124. There may be non-exported or anonymous
  125. functions among them if they are called
  126. dynamically from another package.
  127. </p>
  128. <p>
  129. Click a node to visit that function's source code.
  130. From there you can visit its callers by
  131. clicking its declaring <code>func</code>
  132. token.
  133. </p>
  134. <p>
  135. Functions may be omitted if they were
  136. determined to be unreachable in the
  137. particular programs or tests that were
  138. analyzed.
  139. </p>
  140. <!-- Zero means show all package entry points. -->
  141. <ul style="margin-left: 0.5in" id="callgraph-0" class="treeview"></ul>
  142. </div>
  143. </div> <!-- #pkg-callgraph -->
  144. {{with .Consts}}
  145. <h2 id="pkg-constants">Constants</h2>
  146. {{range .}}
  147. {{comment_html .Doc}}
  148. <pre>{{node_html $ .Decl true}}</pre>
  149. {{end}}
  150. {{end}}
  151. {{with .Vars}}
  152. <h2 id="pkg-variables">Variables</h2>
  153. {{range .}}
  154. {{comment_html .Doc}}
  155. <pre>{{node_html $ .Decl true}}</pre>
  156. {{end}}
  157. {{end}}
  158. {{range .Funcs}}
  159. {{/* Name is a string - no need for FSet */}}
  160. {{$name_html := html .Name}}
  161. <h2 id="{{$name_html}}">func <a href="{{posLink_url $ .Decl}}">{{$name_html}}</a>
  162. <a class="permalink" href="#{{$name_html}}">&#xb6;</a>
  163. </h2>
  164. <pre>{{node_html $ .Decl true}}</pre>
  165. {{comment_html .Doc}}
  166. {{example_html $ .Name}}
  167. {{callgraph_html $ "" .Name}}
  168. {{end}}
  169. {{range .Types}}
  170. {{$tname := .Name}}
  171. {{$tname_html := html .Name}}
  172. <h2 id="{{$tname_html}}">type <a href="{{posLink_url $ .Decl}}">{{$tname_html}}</a>
  173. <a class="permalink" href="#{{$tname_html}}">&#xb6;</a>
  174. </h2>
  175. {{comment_html .Doc}}
  176. <pre>{{node_html $ .Decl true}}</pre>
  177. {{range .Consts}}
  178. {{comment_html .Doc}}
  179. <pre>{{node_html $ .Decl true}}</pre>
  180. {{end}}
  181. {{range .Vars}}
  182. {{comment_html .Doc}}
  183. <pre>{{node_html $ .Decl true}}</pre>
  184. {{end}}
  185. {{example_html $ $tname}}
  186. {{implements_html $ $tname}}
  187. {{methodset_html $ $tname}}
  188. {{range .Funcs}}
  189. {{$name_html := html .Name}}
  190. <h3 id="{{$name_html}}">func <a href="{{posLink_url $ .Decl}}">{{$name_html}}</a>
  191. <a class="permalink" href="#{{$name_html}}">&#xb6;</a>
  192. </h3>
  193. <pre>{{node_html $ .Decl true}}</pre>
  194. {{comment_html .Doc}}
  195. {{example_html $ .Name}}
  196. {{callgraph_html $ "" .Name}}
  197. {{end}}
  198. {{range .Methods}}
  199. {{$name_html := html .Name}}
  200. <h3 id="{{$tname_html}}.{{$name_html}}">func ({{html .Recv}}) <a href="{{posLink_url $ .Decl}}">{{$name_html}}</a>
  201. <a class="permalink" href="#{{$tname_html}}.{{$name_html}}">&#xb6;</a>
  202. </h3>
  203. <pre>{{node_html $ .Decl true}}</pre>
  204. {{comment_html .Doc}}
  205. {{$name := printf "%s_%s" $tname .Name}}
  206. {{example_html $ $name}}
  207. {{callgraph_html $ .Recv .Name}}
  208. {{end}}
  209. {{end}}
  210. {{end}}
  211. {{with $.Notes}}
  212. {{range $marker, $content := .}}
  213. <h2 id="pkg-note-{{$marker}}">{{noteTitle $marker | html}}s</h2>
  214. <ul style="list-style: none; padding: 0;">
  215. {{range .}}
  216. <li><a href="{{posLink_url $ .}}" style="float: left;">&#x261e;</a> {{comment_html .Body}}</li>
  217. {{end}}
  218. </ul>
  219. {{end}}
  220. {{end}}
  221. {{end}}
  222. {{with .PAst}}
  223. {{range $filename, $ast := .}}
  224. <a href="{{$filename|srcLink|html}}">{{$filename|filename|html}}</a>:<pre>{{node_html $ $ast false}}</pre>
  225. {{end}}
  226. {{end}}
  227. {{with .Dirs}}
  228. {{/* DirList entries are numbers and strings - no need for FSet */}}
  229. {{if $.PDoc}}
  230. <h2 id="pkg-subdirectories">Subdirectories</h2>
  231. {{end}}
  232. {{if eq $.Dirname "/src"}}
  233. <div id="manual-nav">
  234. <dl>
  235. <dt><a href="#stdlib">Standard library</a></dt>
  236. <dt><a href="#other">Other packages</a></dt>
  237. <dd><a href="#subrepo">Sub-repositories</a></dd>
  238. <dd><a href="#community">Community</a></dd>
  239. </dl>
  240. </div>
  241. <h2 id="stdlib">Standard library</h2>
  242. <img alt="" class="gopher" src="/doc/gopher/pkg.png"/>
  243. {{end}}
  244. <div class="pkg-dir">
  245. <table>
  246. <tr>
  247. <th class="pkg-name">Name</th>
  248. <th class="pkg-synopsis">Synopsis</th>
  249. </tr>
  250. {{if not (or (eq $.Dirname "/src") (eq $.Dirname "/src/cmd") $.DirFlat)}}
  251. <tr>
  252. <td colspan="2"><a href="..">..</a></td>
  253. </tr>
  254. {{end}}
  255. {{range .List}}
  256. {{if $.DirFlat}}
  257. {{if .HasPkg}}
  258. <tr>
  259. <td class="pkg-name">
  260. <a href="{{html .Path}}/{{modeQueryString $.Mode | html}}">{{html .Path}}</a>
  261. </td>
  262. <td class="pkg-synopsis">
  263. {{html .Synopsis}}
  264. </td>
  265. </tr>
  266. {{end}}
  267. {{else}}
  268. <tr>
  269. <td class="pkg-name" style="padding-left: {{multiply .Depth 20}}px;">
  270. <a href="{{html .Path}}/{{modeQueryString $.Mode | html}}">{{html .Name}}</a>
  271. </td>
  272. <td class="pkg-synopsis">
  273. {{html .Synopsis}}
  274. </td>
  275. </tr>
  276. {{end}}
  277. {{end}}
  278. </table>
  279. </div>
  280. {{if eq $.Dirname "/src"}}
  281. <h2 id="other">Other packages</h2>
  282. <h3 id="subrepo">Sub-repositories</h3>
  283. <p>
  284. These packages are part of the Go Project but outside the main Go tree.
  285. They are developed under looser <a href="/doc/go1compat">compatibility requirements</a> than the Go core.
  286. Install them with "<a href="/cmd/go/#hdr-Download_and_install_packages_and_dependencies">go get</a>".
  287. </p>
  288. <ul>
  289. <li><a href="//godoc.org/golang.org/x/benchmarks">benchmarks</a> — benchmarks to measure Go as it is developed.</li>
  290. <li><a href="//godoc.org/golang.org/x/blog">blog</a><a href="//blog.golang.org">blog.golang.org</a>'s implementation.</li>
  291. <li><a href="//godoc.org/golang.org/x/build">build</a><a href="//build.golang.org">build.golang.org</a>'s implementation.</li>
  292. <li><a href="//godoc.org/golang.org/x/crypto">crypto</a> — additional cryptography packages.</li>
  293. <li><a href="//godoc.org/golang.org/x/debug">debug</a> — an experimental debugger for Go.</li>
  294. <li><a href="//godoc.org/golang.org/x/image">image</a> — additional imaging packages.</li>
  295. <li><a href="//godoc.org/golang.org/x/mobile">mobile</a> — experimental support for Go on mobile platforms.</li>
  296. <li><a href="//godoc.org/golang.org/x/net">net</a> — additional networking packages.</li>
  297. <li><a href="//godoc.org/golang.org/x/sys">sys</a> — packages for making system calls.</li>
  298. <li><a href="//godoc.org/golang.org/x/text">text</a> — packages for working with text.</li>
  299. <li><a href="//godoc.org/golang.org/x/tools">tools</a> — godoc, goimports, gorename, and other tools.</li>
  300. <li><a href="//godoc.org/golang.org/x/tour">tour</a><a href="//tour.golang.org">tour.golang.org</a>'s implementation.</li>
  301. <li><a href="//godoc.org/golang.org/x/exp">exp</a> — experimental and deprecated packages (handle with care; may change without warning).</li>
  302. </ul>
  303. <h3 id="community">Community</h3>
  304. <p>
  305. These services can help you find Open Source packages provided by the community.
  306. </p>
  307. <ul>
  308. <li><a href="//godoc.org">GoDoc</a> - a package index and search engine.</li>
  309. <li><a href="http://go-search.org">Go Search</a> - a code search engine.</li>
  310. <li><a href="/wiki/Projects">Projects at the Go Wiki</a> - a curated list of Go projects.</li>
  311. </ul>
  312. {{end}}
  313. {{end}}