pkgsitegolang.org/x/pkgsite/cmd/pkgsite

pkgsite command

Pkgsite extracts and generates documentation for Go programs. It runs as a web server and presents the documentation as a web page.

To install, run `go install golang.org/x/pkgsite/cmd/pkgsite@latest`.

With no arguments, pkgsite will serve docs for main modules relative to the current directory, i.e. the modules listed by `go list -m`. This is typically the module defined by the nearest go.mod file in a parent directory. However, this may include multiple main modules when using a go.work file to define a workspace.

For example, both of the following forms could be used to work on the module defined in repos/cue/go.mod:

The single module form:

cd repos/cue && pkgsite

The multiple module form:

go work init repos/cue repos/other && pkgsite

By default, the resulting server will also serve all of the module's dependencies at their required versions. You can disable serving the required modules by passing -list=false.

You can also serve docs from your module cache, directly from the proxy (it uses the GOPROXY environment variable), or both:

pkgsite -cache -proxy

With either -cache or -proxy, pkgsite won't look for a module in the current directory. You can still provide modules on the local filesystem by listing their paths:

pkgsite -cache -proxy ~/repos/cue some/other/module

Although standard library packages will work by default, the docs can take a while to appear the first time because the Go repo must be cloned and processed. If you clone the repo yourself (https://go.googlesource.com/go), you can provide its location with the -gorepo flag to save a little time.

Version
v0.0.0-20240424211754-41da83f65020 (latest)
Published
Apr 24, 2024
Platform
linux/amd64
Imports
14 packages
Last checked
3 weeks ago

Tools for package owners.