1
0
docreflect/cmd/docreflect
2026-01-21 22:00:31 +01:00
..
docs.gen.go utilize wand 2026-01-21 22:00:31 +01:00
main.go utilize wand 2026-01-21 22:00:31 +01:00
readme.md utilize wand 2026-01-21 22:00:31 +01:00

docreflect

Synopsis:

docreflect [options]... [--] <outputPackageName string> [path string]...
docreflect <subcommand>

Description:

generates a Go source file containing an init function that registers the documentation for the declarations specified by their fully qualified Go path.

The paths argument accepts arbitrary packages, package-level symbols, or struct fields. Usage of package paths is recommended over specific symbols in most cases.

Limitations:

- Type references (such as type aliases or definitions based on named types) are not resolved.

- Import paths are not followed.

Options:

  • --main, -m bool: indicates that the docs for the symbols will be lookded up as part of the main package of an executable. This is necessary, because the fully qualified Go path of symbols in a main package differs from the path pointing to that package in a module.
  • --help: Show help.

Hints:

  • Bool options can be used with implicit true values.
  • Option values can be set both via = or just separated by space.

Subcommands:

Show help for each subcommand by calling <command> help or <command> --help.

docreflect generate-registry (default)

Synopsis:

docreflect generate-registry [options]... [--] <outputPackageName string> [path string]...
docreflect generate-registry <subcommand>

Description:

generates a Go source file containing an init function that registers the documentation for the declarations specified by their fully qualified Go path.

The paths argument accepts arbitrary packages, package-level symbols, or struct fields. Usage of package paths is recommended over specific symbols in most cases.

Limitations:

- Type references (such as type aliases or definitions based on named types) are not resolved.

- Import paths are not followed.

Options:

  • --main, -m bool: indicates that the docs for the symbols will be lookded up as part of the main package of an executable. This is necessary, because the fully qualified Go path of symbols in a main package differs from the path pointing to that package in a module.
  • --help: Show help.

docreflect version

Show version.

Environment variables:

Every command line option's value can also be provided as an environment variable. Environment variable names need to use snake casing like myapp_foo_bar_baz or MYAPP_FOO_BAR_BAZ, or other casing that doesn't include the '-' dash character, and they need to be prefixed with the name of the application, as in the base name of the command.

When both the environment variable and the command line option is defined, the command line option overrides the environment variable. Multiple values for the same environment variable can be defined by concatenating the values with the ':' separator character. When overriding multiple values with command line options, all the environment values of the same field are dropped.

Example environment variable:

DOCREFLECT_MAIN=true