LinuxCommandLibrary

godoc

TLDR

Start documentation server

$ godoc -http=:6060
copy
Show package docs
$ godoc [fmt]
copy
Show specific function
$ godoc [fmt Println]
copy
Output HTML
$ godoc -html [package]
copy

SYNOPSIS

godoc [options] [package] [symbol]

DESCRIPTION

godoc extracts and generates documentation for Go packages. It can serve documentation as a web server or print to console, providing browsable documentation.
The HTTP server mode provides searchable documentation with source code links. It indexes all packages in GOPATH/GOROOT for comprehensive browsing.
godoc serves and displays Go documentation.

PARAMETERS

PACKAGE

Package to document.
SYMBOL
Symbol to look up.
-http ADDR
Start HTTP server.
-html
Output HTML format.
-src
Show source code.
--help
Display help information.

CAVEATS

Separate install since Go 1.12. Use go doc for quick lookups. Server mode for browsing.

HISTORY

godoc was the original Go documentation tool, now available separately from golang.org/x/tools/cmd/godoc.

SEE ALSO

go-doc(1), go(1)

Copied to clipboard