godocumentor

godocumentor

Documentor-style static documentation for Go.

Point it at any Go source directory and get a polished, self-contained static HTML site — navigation tree, visibility-aware API reference, cross-references, relationship diagrams, syntax-highlighted source, offline search and narrative guides. It runs straight from the filesystem. No server required.

The gap it fills

Go has documentation tooling, but nothing produced a designed, browsable static site the way phpDocumentor does for PHP — until now.

godoc

Deprecated, and serves a live HTTP site rather than static files.

pkgsite

Server-oriented — built to run pkg.go.dev, not to emit a portable site.

gomarkdoc

Only emits Markdown; you still have to build and style a site yourself.

godocumentor

A complete, designed static HTML site you can open from file:// or host anywhere.

What you get

Everything below is generated into one self-contained directory.

API reference

Packages, types, functions, methods, constants and variables — grouped the way go doc groups them, with constructors under their type.

Cross-references

[Type], [pkg.Symbol] and [Type.Method] doc links resolve to the right page; external refs fall back to pkg.go.dev.

Relationship diagrams

Interface implementations and struct embedding rendered as UML class diagrams with Mermaid — client-side, no Graphviz needed.

Source viewer

Every file browsable with linkable line numbers; declarations deep-link straight to their source line.

Offline full-text search

A prebuilt index and a dependency-free client that works from file:// — no backend, no network.

Narrative guides

Drop in Markdown (GFM, front-matter, code highlighting); the target's README.md is shown on the home page.

Theming

Override any built-in template or asset by pointing --theme at a directory. Your files win, the rest are inherited.

Light & dark

The default theme follows the OS color scheme — the page you're reading does too.

Install & use

A single self-contained binary. Download it, point it at your code, open the result.

Download — coming soon

Releases are available for:

  • Linux — amd64, arm64
  • Windows — amd64

Put the binary on your PATH (on Linux, chmod +x it first), then run it against any Go source directory:

# Document the current module into ./docs
godocumentor .

# Document another project, with guides, into a custom directory
godocumentor ./myproject --guides ./myproject/docs/guides -o ./site

# Include unexported identifiers
godocumentor . --private

The site is written to ./docs by default. Open docs/index.html in a browser — no server needed.

Flags

FlagDescription
-o, --outputOutput directory (default docs).
--titleSite title (default: module path or directory name).
--base-urlPath prefix for hosting under a sub-path (default: relative links).
--includeGlob(s) of import paths to include.
--excludeGlob(s) of import paths to exclude.
--privateInclude unexported identifiers.
--sourceRender the syntax-highlighted source viewer and link to it (off by default).
--guidesDirectory of Markdown guide pages.
--themeDirectory overlaying the built-in templates/assets.
--configPath to a YAML config file (default godocumentor.yaml).

Configuration file

Any flag can be set in godocumentor.yaml; command-line flags override it.

title: My Project
output: site
private: false
renderSource: true
guides: docs/guides
exclude:
  - "*/internal/*"

How it works

A two-phase pipeline, mirroring phpDocumentor's parse-cache → render split.

1 — Analyze

Source → model

Loads the target with golang.org/x/tools/go/packages, then builds a serializable intermediate model using go/doc, go/doc/comment and go/types (the last for relationship analysis).

2 — Render

Model → static HTML

Turns the model into static HTML via embedded templates and assets — chroma for highlighting, goldmark for Markdown, Mermaid for diagrams. The output is fully self-contained.