On this page
Checking every constituent project of a unified site in one pass, attributing each diagnostic, directive result and covered symbol to its project.
#internal/blog/unifiedcheck
#internal/blog/unifiedcheck
Package unifiedcheck checks every constituent project of a unified documentation site in one pass.
A unified site is built from several projects plus the docs-site's own cross-cutting content, each with its own selfdoc.json and its own docs tree. [CheckUnified] runs the ordinary documentation check over each of them and merges the answers into one verdict, attributing every diagnostic, every directive result and every covered symbol to the project it came from by prefixing the project's mount slug -- "[core] docs/index.md" -- so a report over a monorepo names a file a reader can open.
#A project the check cannot reach is a diagnostic, not a crash
Two conditions belong to the unified run rather than to any one project: a constituent directory carrying no selfdoc.json (UNIFIED001) and a constituent whose check refuses to run at all (UNIFIED002, carrying the refusal's own message). Either one is recorded against the project and the remaining projects are still checked, because a monorepo's report is worth more than the first thing wrong with it.
#CommonSlug
const CommonSlug = "common"CommonSlug is the attribution prefix the docs-site's own pages carry.
The docs-site is the (N+1)th project of a unified build, and its pages are mounted under "common", so its diagnostics are labelled the same way a constituent project's are rather than being left unattributed.
#CheckUnified
func CheckUnified(CheckUnified checks every constituent project of a unified build, plus the docs-site's own content, and returns one merged verdict.
It walks the projects the config's "unified" block names, loads each one's own selfdoc.json, and runs [check.CheckDocs] against it. Every directive result, every diagnostic and every covered symbol is prefixed with the project's mount slug, and the coverage counts of the constituent projects are summed. The docs-site's own content is checked last, under [CommonSlug]; its coverage is not merged, because the docs-site declares the site rather than the API the count measures.
projectConfig may be nil, in which case it is loaded from selfdoc.json in dirPath. dryRun reports staleness without writing the hash store.
A project directory with no selfdoc.json becomes a UNIFIED001 diagnostic and a project whose check refuses becomes a UNIFIED002 diagnostic carrying the refusal's message; in both cases the remaining projects are still checked. A config that cannot be read, and a declared project path that does not name a directory, are errors: the whole run is described by those declarations, so a typo in one is not something to report as a finding somewhere far downstream.