printer

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2018 License: MPL-2.0 Imports: 8 Imported by: 519 modules, 460 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

Jump to

Keyboard shortcuts

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