datadep

package
v0.7.5-beta.1 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2026 License: Apache-2.0 Imports: 6 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 datadep builds docs/data-dependence.md from one file per table row.

Why: all rows used to live in one Markdown table, so two PRs that each added a row conflicted in that file (#1088). Now each row is its own file under docs/data-dependence/<section>/, and this package builds the page from them and a template.

Row file format. It is NOT YAML. The standard library parses it:

---
key: value        (one line each; split at the first ": ")
order: 30         (optional; sorts rows; default 1000; ties sort by file name)
---

The reason, in plain words, on any number of lines. Newlines become spaces in the table.

Index

Constants

View Source
const PagePath = "docs/data-dependence.md"

PagePath is the generated page, relative to the repo root.

View Source
const RegenCommand = "go run ./cmd/gen-datadep"

RegenCommand is the command that rewrites the page. Tests print it.

Variables

View Source
var (
	Components = Section{
		Dir: "components", Placeholder: "{{component_rows}}",
		Keys:         []string{"name", "kind", "where", "off", "metadata_only", "everything", "decided_by", "order"},
		Columns:      []string{"name", "kind", "where", "off", "metadata_only", "everything", "reason", "decided_by"},
		BacktickName: true,
	}
	Features = Section{
		Dir: "features", Placeholder: "{{feature_rows}}",
		Keys:    []string{"name", "kind", "off", "metadata_only", "everything", "order"},
		Columns: []string{"name", "kind", "off", "metadata_only", "everything", "reason"},
	}
	Sections = []Section{Components, Features}
)

Functions

func Build

func Build(root string) (string, error)

Build returns the page: the template with each placeholder line replaced by its rows.

Types

type Row

type Row struct {
	File   string // path of the file, for messages
	Stem   string // file name without ".md"
	Fields map[string]string
	Order  int
}

Row is one parsed row file.

func Load

func Load(root string, s Section) ([]Row, error)

Load reads every .md file in <root>/docs/data-dependence/<s.Dir>, sorted by (order, file name). It fails on an unknown or missing key, a duplicate key, a bad order, or a file without the front matter. It does not judge the content of a cell; the tests do that.

func (Row) Line

func (r Row) Line(s Section) string

Line renders the row as a Markdown table row.

type Section

type Section struct {
	Dir          string   // under docs/data-dependence/
	Placeholder  string   // the line in the template that the rows replace
	Keys         []string // front matter keys, in the order they are allowed to be written
	Columns      []string // cells, in column order; "reason" is the body; "name" may be wrapped
	BacktickName bool     // render the name cell as `name`
}

Section describes one table: its directory, and its cells in column order. The key "name" is the first cell. The body of the file is the cell "reason".

Jump to

Keyboard shortcuts

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