Help us shape the future of Go! Take the 2026 Go Developer Survey

parser

package
v5.14.0 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const MaxFileSizeBytes = 1024 * 1024 // 1MiB

Variables

View Source
var (
	// ErrNoLocation is thrown when no location is provided for the Playbook file
	ErrNoLocation = fmt.Errorf("playbook location was not provided")
	// ErrReadFile is thrown when the Playbook file cannot be read/accessed
	ErrReadFile = fmt.Errorf("could not read playbook file")
	// ErrFileTooBig is thrown when the Playbook file exceeds the max file size
	ErrFileTooBig = fmt.Errorf("could not read playbook file")
	// ErrTextTplParsing is thrown when the templates in the Playbook file cannot be parsed.
	//
	// E.g. {{ Env "Hostname" }}
	ErrTextTplParsing = fmt.Errorf("failed to parse the playbook file")
	// ErrFileUnmarshall is thrown when the content of the Playbook file cannot be successfully unmarshalled into a domain.Playbook object
	ErrFileUnmarshall = fmt.Errorf("failed to unmarshal the playbook file")
)

Functions

func ReadPlaybook

func ReadPlaybook(location string) (domain.Playbook, error)

ReadPlaybook reads the file in location, parses the content and returns a Playbook object

func ReadPlaybookRaw

func ReadPlaybookRaw(location string) (map[string]interface{}, error)

ReadPlaybookRaw reads the file in location and parses the content to a map.

This is specially useful to avoid parsing the template values in the file

func WritePlaybook

func WritePlaybook(object interface{}, location string) error

WritePlaybook takes an object and serializes it to a file in the given location

Types

This section is empty.

Jump to

Keyboard shortcuts

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