yamldocs

command
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2026 License: MIT Imports: 14 Imported by: ? 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

Command yamldocs извлекает комментарии ключей из doc-комментариев Go-структур конфигурации и генерирует для yconf таблицу yconf.DocComments - «документацию ключей YAML» в виде данных.

Зачем: конфигурация читается человеком, а смысл ключа уже описан в doc-комментарии поля структуры. Держать текст в двух местах (в комментарии и в yaml-теге `doc:`) - гарантированный дрейф, а читать исходники в рантайме нельзя: на целевой машине их нет. Поэтому комментарии переносятся в данные на этапе генерации, компилируются в бинарь и попадают в YAML через yconf (Write/Migrate/Rewrite).

Источник истины - doc-комментарии полей структур. Изменили комментарий - перегенерируйте файл (`make confdocs`), расхождение ловит `make confdocs-check`.

Использование:

go run ./tools/confdocs -out config/confdoc_gen.go \
    ./config ./proxy ./tunnel ./pkg/xlog
go run ./tools/confdocs -out config/confdoc_gen.go -check ./config ...

Jump to

Keyboard shortcuts

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