diff

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2020 License: Apache-2.0 Imports: 7 Imported by: 1

Documentation

Overview

Package diff provides the Diff class that can be used to compare CloudFormation templates

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Diff

type Diff interface {
	// Mode represents the type of change in a Diff
	Mode() Mode

	// String returns a string representation of the Diff
	String() string

	// Format returns a pretty-printed representation of the Diff
	// The long flag determines whether to produce long or short output
	Format(bool) string
	// contains filtered or unexported methods
}

Diff is the common interface for the other types in this package.

A Diff represents the difference (or lack of difference) between two values

func New

func New(a, b cft.Template) Diff

New returns a Diff that represents the difference between two templates

Example
original := map[string]interface{}{
	"foo": []interface{}{
		"bar",
		"baz",
	},
	"quux": map[string]interface{}{
		"mooz": "xyzzy",
	},
}

fmt.Println(compareValues(original, map[string]interface{}{
	"cake": "lie",
}))
Output:

(|)map[cake:(+)lie foo:(-)[bar baz] quux:(-)map[mooz:xyzzy]]

type Mode

type Mode string

Mode represents a diff mode

const (
	// Added represents a new value
	Added Mode = "+"

	// Removed represents a removed value
	Removed Mode = "-"

	// Changed represents a modified value
	Changed Mode = ">"

	// Involved represents a value that contains changes but is not wholly new itself
	Involved Mode = "|"

	// Unchanged represents a value that has not changed
	Unchanged Mode = "="
)

func (Mode) String

func (m Mode) String() string

Jump to

Keyboard shortcuts

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