Skip to content

fix bug in docsite check template with zero headings

Administrator requested to merge docsite-check-template into master

Created by: sqs

If a doc/ Markdown document has zero headings (i.e., no # Foo or #### Foo headings), docsite check would fail with an inscrutable error like:

dev/release_issue_template.md: template: root:22:41: executing "index" at <index .Doc.Tree 0>: error calling index: index out of range: 0
dev/releases.md: broken link to /dev/release_issue_template
dev/releases.md: broken link to /dev/release_issue_template

This occurs because the Go template expression tries to index into the 0th element. Go's template expressions don't short-circuit, so this index attempt occurs even if the length check fails.

We don't need this precise behavior because this template is only used for checking, not for actual rendering.

https://sourcegraph.slack.com/archives/C07KZF47K/p1549645446768200?thread_ts=1549569483.746300&cid=C07KZF47K

Merge request reports

Loading