File: godoc.1

package info (click to toggle)
golang-golang-x-tools 1%3A0.5.0%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bookworm-backports
  • size: 16,592 kB
  • sloc: javascript: 2,011; asm: 1,635; sh: 192; yacc: 155; makefile: 52; ansic: 8
file content (171 lines) | stat: -rw-r--r-- 5,117 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
.\"                                      Hey, EMACS: -*- nroff -*-
.de Vb \" Begin verbatim text
.ft CW
.nf
.ne \\$1
..
.de Ve \" End verbatim text
.ft R
.fi
..
.TH GODOC 1 "2019-07-31"
.\" Please adjust this date whenever revising the manpage.
.SH NAME
godoc \- extracts and generates documentation for Go programs
.SH SYNOPSIS
.B godoc
.RI [ flag ]
.SH DESCRIPTION
Godoc extracts and generates documentation for Go programs.

It runs as a web server and presents the documentation as a web page.

.Vb 6
\&      godoc \-http=:6060
.Ve

.SH OPTIONS

.TP
.B \-v
verbose mode
.TP
.B \-timestamps=true
show timestamps with directory listings
.TP
.B \-index
enable identifier and full text search index
(no search box is shown if \-index is not set)
.TP
.B \-index_files=""
glob pattern specifying index files; if not empty,
the index is read from these files in sorted order
.TP
.B \-index_throttle=0.75
index throttle value; a value of 0 means no time is allocated
to the indexer (the indexer will never finish), a value of 1.0
means that index creation is running at full throttle (other
goroutines may get no time while the index is built)
.TP
.B \-index_interval=0
interval of indexing; a value of 0 sets it to 5 minutes, a
negative value indexes only once at startup
.TP
.B \-play=false
enable playground
.TP
.B \-links=true
link identifiers to their declarations
.TP
.B \-write_index=false
write index to a file; the file name must be specified with
\-index_files
.TP
.B \-maxresults=10000
maximum number of full text search results shown
(no full text index is built if maxresults <= 0)
.TP
.B \-notes="BUG"
regular expression matching note markers to show
(e.g., "BUG|TODO", ".*")
.TP
.B \-goroot=$GOROOT
Go root directory
.TP
.B \-http=addr
HTTP service address (e.g., '127.0.0.1:6060' or just ':6060')
.TP
.B \-analysis=type,pointer
comma-separated list of analyses to perform
.br
"type": display identifier resolution, type info, method sets,
        'implements', and static callees
.br
"pointer": display channel peers, callers and dynamic callees
        (significantly slower)
.br
See https://golang.org/lib/godoc/analysis/help.html for details.
.TP
.B \-templates=""
directory containing alternate template files; if set,
the directory may provide alternative template files
for the files in $GOROOT/lib/godoc
.TP
.B \-url=path
print to standard output the data that would be served by
an HTTP request for path
.TP
.B \-zip=""
zip file providing the file system to serve; disabled if empty

.SH DISCUSSION

By default, godoc looks at the packages it finds via $GOROOT and $GOPATH
(if set).

When the \-index flag is set, a search index is maintained.
The index is created at startup.

The index contains both identifier and full text search information
(searchable via regular expressions). The maximum number of full text
search results shown can be set with the \-maxresults flag; if set to 0,
no full text results are shown, and only an identifier index but no full
text search index is created.

By default, godoc uses the system's GOOS/GOARCH. You can provide the URL
parameters "GOOS" and "GOARCH" to set the output on the web page for the target system.

The presentation mode of web pages served by godoc can be controlled
with the "m" URL parameter; it accepts a comma-separated list of flag
names as value:

.TP
.B all
show documentation for all declarations, not just the exported ones
.TP
.B methods
show all embedded methods, not just those of unexported anonymous fields
.TP
.B src
show the original source code rather then the extracted documentation
.TP
.B text
present the page in textual (command-line) form rather than HTML
.TP
.B flat
present flat (not indented) directory listings using full paths
.P
For instance, http://golang.org/pkg/math/big/?m=all,text shows the
documentation for all (not just the exported) declarations of package
big, in textual form (as it would appear when using godoc from the
command line: "godoc \-src math/big .*").

By default, godoc serves files from the file system of the underlying
OS. Instead, a .zip file may be provided via the \-zip flag, which
contains the file system to serve. The file paths stored in the .zip
file must use slash ('/') as path separator; and they must be unrooted.
$GOROOT (or \-goroot) must be set to the .zip file directory path
containing the Go root directory. For instance, for a .zip file created
by the command:

.Vb 6
\&      zip go.zip $HOME/go
.Ve

one may run godoc as follows:

.Vb 6
\&      godoc \-http=:6060 \-zip=go.zip \-goroot=$HOME/go
.Ve

Godoc documentation is converted to HTML or to text using the go/doc
package; see https://golang.org/pkg/go/doc/#ToHTML for the exact rules.
Godoc also shows example code that is runnable by the testing package;
see https://golang.org/pkg/testing/#hdr-Examples for the conventions.
See "Godoc: documenting Go code" for how to write good comments for
godoc: http://golang.org/doc/articles/godoc_documenting_go_code.html

.SH AUTHOR
.PP
This manual page was written by Michael Stapelberg <stapelberg@debian.org>,
for the Debian project (and may be used by others).