lib

package
v1.0.0-...-5ac96c6 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2016 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package lib implements some library functions used by gentmpl utility.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func ResolveIncludes

func ResolveIncludes(mapping map[string][]string, names []string) (map[string][]string, error)

ResolveIncludes returns a modified version of the input mapping. It filter the elements taking only the keys found in the names array. Moreover every item that corrispond to a mapping key name is (recursivery) expanded with the mapping items. It returs an error in case of cyclic includes.

Example
var (
	mapping = map[string][]string{
		"inc": {"header", "footer"},
		"A":   {"contentA", "inc"},
		"B":   {"contentB", "inc"},
	}
	names = []string{"A", "B"}
)
res, _ := ResolveIncludes(mapping, names)
fmt.Println(res["A"])
fmt.Println(res["B"])
Output:

[contentA header footer]
[contentB header footer]

Types

This section is empty.

Jump to

Keyboard shortcuts

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