Back to godoc.org

Package printer

v0.0.0-...-392dba7
Latest Go to latest

The latest major version is .

Published: May 9, 2017 | License: MPL-2.0 | Module: github.com/daidokoro/hcl

Overview

Package printer implements printing of AST nodes to HCL format.

Index

Variables

var DefaultConfig = Config{
	SpacesWidth: 2,
}

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.

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

Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier