Documentation
¶
Overview ¶
Package helpers has some useful functions to choose parser and ease scan maps and slices.
Index ¶
- func CountLeadingSpaces(line string) int
- func Discard(slice []interface{}, n interface{}) []interface{}
- func GetParser(filename string) (...)
- func IsNonStringFloatBool(v interface{}) bool
- func IsPlainMap(mp map[string]interface{}) bool
- func IsPlainSlice(slc []interface{}) bool
- func ParseJSON(templateFile []byte, refTemplate template.Template, logger logger.LoggerInt) (template cloudformation.Template, err error)
- func ParseYAML(templateFile []byte, refTemplate template.Template, logger logger.LoggerInt) (template cloudformation.Template, err error)
- func PrettyPrintJSON(toPrint interface{}) ([]byte, error)
- func SliceContains(list []string, a string) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CountLeadingSpaces ¶
CountLeadingSpaces counts leading spaces. It's used in checkYamlIndentation() to find indentation error in template.
func Discard ¶
func Discard(slice []interface{}, n interface{}) []interface{}
Discard looks for elements which are not the same and return only unique.
func GetParser ¶
func GetParser(filename string) (func([]byte, template.Template, logger.LoggerInt) (cloudformation.Template, error), error)
GetParser chooses parser based on file extension.
func IsNonStringFloatBool ¶
func IsNonStringFloatBool(v interface{}) bool
IsNonStringFloatBool checks if the element is non-string, non-float64, non-boolean. Then it is another node or <nil>. There is no other option.
func IsPlainMap ¶
IsPlainMap checks if map is plain. Plain map means that it's non-nil and it doesn't contain nested maps. It's used in checkWhereIsNil().
func IsPlainSlice ¶
func IsPlainSlice(slc []interface{}) bool
IsPlainSlice checks if slice is plain. Slice is plain if it's non-nil and doesn't contain nested maps. It's used in checkWhereIsNil().
func ParseJSON ¶
func ParseJSON(templateFile []byte, refTemplate template.Template, logger logger.LoggerInt) (template cloudformation.Template, err error)
ParseJSON parses JSON template file to cloudformation template.
func ParseYAML ¶
func ParseYAML(templateFile []byte, refTemplate template.Template, logger logger.LoggerInt) (template cloudformation.Template, err error)
ParseYAML parses YAML template file to cloudformation template.
func PrettyPrintJSON ¶
PrettyPrintJSON prepares JSON file with indent to ease reading it.
func SliceContains ¶
SliceContains checks if slice contains given string.
Types ¶
This section is empty.