| 1 |
.\" Hey, EMACS: -*- nroff -*- |
| 2 |
.de Vb \" Begin verbatim text |
| 3 |
.ft CW |
| 4 |
.nf |
| 5 |
.ne \\$1 |
| 6 |
.. |
| 7 |
.de Ve \" End verbatim text |
| 8 |
.ft R |
| 9 |
.fi |
| 10 |
.. |
| 11 |
.TH GODOC 1 "2019-07-31" |
| 12 |
.\" Please adjust this date whenever revising the manpage. |
| 13 |
.SH NAME |
| 14 |
godoc \- extracts and generates documentation for Go programs |
| 15 |
.SH SYNOPSIS |
| 16 |
.B godoc |
| 17 |
.RI [ flag ] |
| 18 |
.SH DESCRIPTION |
| 19 |
Godoc extracts and generates documentation for Go programs. |
| 20 |
|
| 21 |
It runs as a web server and presents the documentation as a web page. |
| 22 |
|
| 23 |
.Vb 6 |
| 24 |
\& godoc \-http=:6060 |
| 25 |
.Ve |
| 26 |
|
| 27 |
.SH OPTIONS |
| 28 |
|
| 29 |
.TP |
| 30 |
.B \-v |
| 31 |
verbose mode |
| 32 |
.TP |
| 33 |
.B \-timestamps=true |
| 34 |
show timestamps with directory listings |
| 35 |
.TP |
| 36 |
.B \-index |
| 37 |
enable identifier and full text search index |
| 38 |
(no search box is shown if \-index is not set) |
| 39 |
.TP |
| 40 |
.B \-index_files="" |
| 41 |
glob pattern specifying index files; if not empty, |
| 42 |
the index is read from these files in sorted order |
| 43 |
.TP |
| 44 |
.B \-index_throttle=0.75 |
| 45 |
index throttle value; a value of 0 means no time is allocated |
| 46 |
to the indexer (the indexer will never finish), a value of 1.0 |
| 47 |
means that index creation is running at full throttle (other |
| 48 |
goroutines may get no time while the index is built) |
| 49 |
.TP |
| 50 |
.B \-index_interval=0 |
| 51 |
interval of indexing; a value of 0 sets it to 5 minutes, a |
| 52 |
negative value indexes only once at startup |
| 53 |
.TP |
| 54 |
.B \-play=false |
| 55 |
enable playground |
| 56 |
.TP |
| 57 |
.B \-links=true |
| 58 |
link identifiers to their declarations |
| 59 |
.TP |
| 60 |
.B \-write_index=false |
| 61 |
write index to a file; the file name must be specified with |
| 62 |
\-index_files |
| 63 |
.TP |
| 64 |
.B \-maxresults=10000 |
| 65 |
maximum number of full text search results shown |
| 66 |
(no full text index is built if maxresults <= 0) |
| 67 |
.TP |
| 68 |
.B \-notes="BUG" |
| 69 |
regular expression matching note markers to show |
| 70 |
(e.g., "BUG|TODO", ".*") |
| 71 |
.TP |
| 72 |
.B \-goroot=$GOROOT |
| 73 |
Go root directory |
| 74 |
.TP |
| 75 |
.B \-http=addr |
| 76 |
HTTP service address (e.g., '127.0.0.1:6060' or just ':6060') |
| 77 |
.TP |
| 78 |
.B \-analysis=type,pointer |
| 79 |
comma-separated list of analyses to perform |
| 80 |
.br |
| 81 |
"type": display identifier resolution, type info, method sets, |
| 82 |
'implements', and static callees |
| 83 |
.br |
| 84 |
"pointer": display channel peers, callers and dynamic callees |
| 85 |
(significantly slower) |
| 86 |
.br |
| 87 |
See https://golang.org/lib/godoc/analysis/help.html for details. |
| 88 |
.TP |
| 89 |
.B \-templates="" |
| 90 |
directory containing alternate template files; if set, |
| 91 |
the directory may provide alternative template files |
| 92 |
for the files in $GOROOT/lib/godoc |
| 93 |
.TP |
| 94 |
.B \-url=path |
| 95 |
print to standard output the data that would be served by |
| 96 |
an HTTP request for path |
| 97 |
.TP |
| 98 |
.B \-zip="" |
| 99 |
zip file providing the file system to serve; disabled if empty |
| 100 |
|
| 101 |
.SH DISCUSSION |
| 102 |
|
| 103 |
By default, godoc looks at the packages it finds via $GOROOT and $GOPATH |
| 104 |
(if set). |
| 105 |
|
| 106 |
When the \-index flag is set, a search index is maintained. |
| 107 |
The index is created at startup. |
| 108 |
|
| 109 |
The index contains both identifier and full text search information |
| 110 |
(searchable via regular expressions). The maximum number of full text |
| 111 |
search results shown can be set with the \-maxresults flag; if set to 0, |
| 112 |
no full text results are shown, and only an identifier index but no full |
| 113 |
text search index is created. |
| 114 |
|
| 115 |
By default, godoc uses the system's GOOS/GOARCH. You can provide the URL |
| 116 |
parameters "GOOS" and "GOARCH" to set the output on the web page for the target system. |
| 117 |
|
| 118 |
The presentation mode of web pages served by godoc can be controlled |
| 119 |
with the "m" URL parameter; it accepts a comma-separated list of flag |
| 120 |
names as value: |
| 121 |
|
| 122 |
.TP |
| 123 |
.B all |
| 124 |
show documentation for all declarations, not just the exported ones |
| 125 |
.TP |
| 126 |
.B methods |
| 127 |
show all embedded methods, not just those of unexported anonymous fields |
| 128 |
.TP |
| 129 |
.B src |
| 130 |
show the original source code rather then the extracted documentation |
| 131 |
.TP |
| 132 |
.B text |
| 133 |
present the page in textual (command-line) form rather than HTML |
| 134 |
.TP |
| 135 |
.B flat |
| 136 |
present flat (not indented) directory listings using full paths |
| 137 |
.P |
| 138 |
For instance, http://golang.org/pkg/math/big/?m=all,text shows the |
| 139 |
documentation for all (not just the exported) declarations of package |
| 140 |
big, in textual form (as it would appear when using godoc from the |
| 141 |
command line: "godoc \-src math/big .*"). |
| 142 |
|
| 143 |
By default, godoc serves files from the file system of the underlying |
| 144 |
OS. Instead, a .zip file may be provided via the \-zip flag, which |
| 145 |
contains the file system to serve. The file paths stored in the .zip |
| 146 |
file must use slash ('/') as path separator; and they must be unrooted. |
| 147 |
$GOROOT (or \-goroot) must be set to the .zip file directory path |
| 148 |
containing the Go root directory. For instance, for a .zip file created |
| 149 |
by the command: |
| 150 |
|
| 151 |
.Vb 6 |
| 152 |
\& zip go.zip $HOME/go |
| 153 |
.Ve |
| 154 |
|
| 155 |
one may run godoc as follows: |
| 156 |
|
| 157 |
.Vb 6 |
| 158 |
\& godoc \-http=:6060 \-zip=go.zip \-goroot=$HOME/go |
| 159 |
.Ve |
| 160 |
|
| 161 |
Godoc documentation is converted to HTML or to text using the go/doc |
| 162 |
package; see https://golang.org/pkg/go/doc/#ToHTML for the exact rules. |
| 163 |
Godoc also shows example code that is runnable by the testing package; |
| 164 |
see https://golang.org/pkg/testing/#hdr-Examples for the conventions. |
| 165 |
See "Godoc: documenting Go code" for how to write good comments for |
| 166 |
godoc: http://golang.org/doc/articles/godoc_documenting_go_code.html |
| 167 |
|
| 168 |
.SH AUTHOR |
| 169 |
.PP |
| 170 |
This manual page was written by Michael Stapelberg <[email protected]>, |
| 171 |
for the Debian project (and may be used by others). |