[cmd/mdatagen] Enforce tab indentation in Go template files#15444
[cmd/mdatagen] Enforce tab indentation in Go template files#15444Goutham-Annem wants to merge 3 commits into
Conversation
2f2cd7c to
db5b9f8
Compare
Merging this PR will create unknown performance changes
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #15444 +/- ##
=======================================
Coverage 91.03% 91.03%
=======================================
Files 729 729
Lines 48491 48491
=======================================
Hits 44144 44144
Misses 3020 3020
Partials 1327 1327 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
14820e0 to
a167a91
Compare
a167a91 to
a702d72
Compare
a702d72 to
e182186
Compare
Go template files in cmd/mdatagen/internal/templates/ were using 4-space indentation in code blocks generated by upstream additions. Convert all leading 4-space groups to tabs to match Go formatting conventions and make the templates consistent with gofmt output. Assisted-by: Claude Sonnet 4.6
e182186 to
296b80d
Compare
config.schema.yaml.tmpl generates YAML output; YAML forbids tab characters as indentation (yaml spec §5.5). Reverting to spaces prevents 'found character that cannot start any token' from mdatagen during make gogenerate. Also add required .chloggen entry for this PR. Assisted-by: Claude Sonnet 4.6
documentation.md.tmpl contains YAML code examples (enabled: true/false inside metric/event config snippets) that are emitted verbatim into the generated documentation.md files. Tab indentation in those snippets caused make gogenerate to produce tabs in the output, failing the 'Generated code is out of date' diff check. Only Go template files (.go.tmpl) should use tab indentation. Assisted-by: Claude Sonnet 4.6
Description
Added a
check-template-tabsMakefile target and a corresponding CI step inbuild-and-test.ymlthat fails if any.go.tmplfile undercmd/mdatagenorcmd/buildercontains lines with leading spaces. Converted the two remaining offending templates (config_from_cfggen.go.tmplandconfig_from_cfggen_test.go.tmpl) from space indentation to tab indentation to bring them in line with all other templates.Link to tracking issue
Fixes #14698
Testing
Ran
make check-template-tabslocally — passes with no output. All other.go.tmplfiles were already tab-indented and continue to pass.Documentation
No documentation changes needed. The
check-template-tabstarget is self-documenting via the Makefile.Authorship