docgen

Get started

Install

In this step you install docgen, or set up a repository to run a pinned version of it.

What you need§

  • Go 1.27.0 or later, the version of the go line of the docgen module.
  • A Go module to document. Markers that use no Go code, such as a YAML excerpt, work in a repository with no module.

Install the command§

go install github.com/USA-RedDragon/docgen@latest

Run a pinned version§

To give everyone and CI the same version, run docgen with a version in place of installing it. This does not change the go.mod of your repository:

go run github.com/USA-RedDragon/docgen@v0.1.0 check

Use a go:generate line to run it with your other generators:

//go:generate go run github.com/USA-RedDragon/docgen@v0.1.0 update

Run docgen as a tool§

A tool directive also pins a version:

go get -tool github.com/USA-RedDragon/docgen@v0.1.0
go tool docgen check

It adds the docgen dependencies to your go.mod and raises its go line to the docgen version. Do not use it in a library that supports an earlier Go version.

For a GitHub Action and a pre-commit hook, see Check the docs in CI.

Next§

Go to Your first page.

Source: docs/start/01-install.md