hclfmt

package
v2.7.4 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2025 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const NumSpacesPerIndent = 1

Variables

This section is empty.

Functions

func FormatBytes

func FormatBytes(cfg format.Configuration, src []byte) (io.Reader, error)

Types

type Formatter

type Formatter struct {
}

func NewFormatter

func NewFormatter() *Formatter

func (*Formatter) Format

func (me *Formatter) Format(ctx context.Context, cfg format.Configuration, read io.Reader) (io.Reader, error)

type Token

type Token struct {
	hclwrite.Token
	TabsBefore int
}

type Tokens

type Tokens []*Token

func (Tokens) Columns

func (ts Tokens) Columns() int

Columns returns the number of columns (grapheme clusters) the token sequence occupies. The result is not meaningful if there are newline or single-line comment tokens in the sequence.

func (Tokens) WriteTo

func (ts Tokens) WriteTo(wr io.Writer, cfg format.Configuration) (int64, error)

WriteTo takes an io.Writer and writes the bytes for each token to it, along with the spacing that separates each token. In other words, this allows serializing the tokens to a file or other such byte stream.

Jump to

Keyboard shortcuts

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