Documentation

Overview

    Package printer implements printing of AST nodes to HCL format.

    Index

    Constants

    This section is empty.

    Variables

    View Source
    var DefaultConfig = Config{
    	SpacesWidth: 2,
    }

    Functions

    func Format

    func Format(src []byte) ([]byte, error)

      Format formats src HCL and returns the result.

      func Fprint

      func Fprint(output io.Writer, node ast.Node) error

        Fprint "pretty-prints" an HCL node to output It calls Config.Fprint with default settings.

        Types

        type ByPosition

        type ByPosition []*ast.CommentGroup

        func (ByPosition) Len

        func (b ByPosition) Len() int

        func (ByPosition) Less

        func (b ByPosition) Less(i, j int) bool

        func (ByPosition) Swap

        func (b ByPosition) Swap(i, j int)

        type Config

        type Config struct {
        	SpacesWidth int // if set, it will use spaces instead of tabs for alignment
        }

          A Config node controls the output of Fprint.

          func (*Config) Fprint

          func (c *Config) Fprint(output io.Writer, node ast.Node) error