blob: 64d8c31002ad2fbe9179a6d3e9b871494ffb2e14 [file] [log] [blame]
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
Godoc extracts and generates documentation for Go programs.
It runs as a web server and presents the documentation as a
web page.
godoc -http=:6060
godoc [flag]
The flags are:
verbose mode
show timestamps with directory listings
enable playground
link identifiers to their declarations
regular expression matching note markers to show
(e.g., "BUG|TODO", ".*")
Go root directory
HTTP service address (e.g., '' or just ':6060')
directory containing alternate template files; if set,
the directory may provide alternative template files
for the files in _content/
By default, golangorg looks at the packages it finds via $GOROOT (if set).
This behavior can be altered by providing an alternative $GOROOT with the -goroot
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:
all show documentation for all declarations, not just the exported ones
methods show all embedded methods, not just those of unexported anonymous fields
src show the original source code rather than the extracted documentation
flat present flat (not indented) directory listings using full paths
For instance, shows the documentation
for all (not just the exported) declarations of package big.
Godoc serves files from the file system of the underlying OS.
Godoc documentation is converted to HTML or to text using the go/doc package;
see for the exact rules.
Godoc also shows example code that is runnable by the testing package;
see for the conventions.
See "Godoc: documenting Go code" for how to write good comments for godoc:
package main // import ""