Helm2cue: An experiment in converting Go text/template to CUE
Helm2cue is an experimental project aimed at converting Go's text/template to CUE, using Helm charts as a primary example. The initiative addresses common issues faced by various template languages that generate structured data. It focuses on automating the conversion process while maintaining the integrity of the original templates.
- ▪Helm2cue converts Go text/template files to CUE, focusing on structured data generation.
- ▪The project is motivated by challenges in various template languages, including Jinja in Python.
- ▪Helm serves as a test case due to its extensive use of Go's text/template features.
Opening excerpt (first ~120 words) tap to expand
helm2cue An experiment in converting Go text/template to CUE, using Helm charts as the driving example. Go's text/template package is widely used to generate structured output (YAML, JSON, etc.) from templates with control flow, pipelines, and helper definitions. CUE can express the same data more directly, with types, defaults, and constraints instead of string interpolation and whitespace wrangling. This project explores how far an automated conversion from one to the other can go. The underlying problem is not specific to Go or Helm. Conversations with people struggling with Jinja templates in the Python world (Ansible, SaltStack, etc.) helped motivate this work: any template language that generates structured data by splicing strings into YAML or JSON hits the same class of issues.
…
Excerpt limited to ~120 words for fair-use compliance. The full article is at GitHub.