hclcomment

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package hclcomment writes comments into an hclwrite body.

It sits here rather than beside its first caller because both the providers and the step package write comments, and the step package is imported by the providers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Line

func Line(line string) string

Line returns line as an HCL comment, adding a "#" only if the line does not already carry one. Everything else about the text is left alone.

func Trailing

func Trailing(tokens hclwrite.Tokens, comment string) hclwrite.Tokens

Trailing returns tokens with comment appended, so it lands on the same line as the value those tokens write. An empty comment returns tokens unchanged.

No newline in the comment bytes: the attribute brings its own, and a second one leaves a blank line after every commented attribute.

func WriteLeading

func WriteLeading(body *hclwrite.Body, comment string)

WriteLeading emits comment as HCL comment lines above whatever is appended next. An empty comment writes nothing.

The text is written as it was read. A comment is prose, and its spacing, its "#" count and its indentation are things its author chose, so rewriting them changes what was written for no gain. The one thing added is a missing "#": a line reaching HCL without one is not a comment but a syntax error in the generated file.

Types

This section is empty.

Jump to

Keyboard shortcuts

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