schemadoc

package
v0.3.13 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 5, 2026 License: MIT Imports: 11 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package schemadoc extracts the config schema descriptions from the config package's doc comments, the way schemars reads Rust doc comments: a type's description is its doc after the first paragraph (the Go sentence naming the type, which revive requires), a field's is its whole doc, and an enum variant's is its constant's doc. The text is kept verbatim (markdown), one leading space stripped per line.

Generate renders the result as schemadoc_gen.go; `go generate ./config` writes it and config's tests fail when it is stale.

Index

Constants

View Source
const OutputName = "schemadoc_gen.go"

OutputName is the generated file's name inside the package dir.

Variables

This section is empty.

Functions

func Extract

func Extract(dir string) (map[string]string, error)

Extract reads every non-test Go file of the package in dir and returns the description map: "Type" for types, "Type.Field" for struct fields, "Type=value" for string enum constants.

func Generate

func Generate(dir, pkg string) ([]byte, error)

Generate renders the description map as the package's generated Go file.

Types

This section is empty.

Directories

Path Synopsis
Command schemadoc regenerates config/schemadoc_gen.go; run it through `go generate ./config`.
Command schemadoc regenerates config/schemadoc_gen.go; run it through `go generate ./config`.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL