compare

package
v0.106.0 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2025 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Comparer

type Comparer struct {
}

Comparer handles comparison operations between BuildPlans

func New

func New() *Comparer

New creates a new Comparer instance

func (*Comparer) BuildPlans

func (c *Comparer) BuildPlans(one, two string, isBackwardsCompatible bool) error

BuildPlans compares two BuildPlan Files for semantic equivalence.

The holos show buildplans command writes a BuildPlan File to standard output. A BuildPlan File is a yaml encoded stream of BuildPlan objects.

BuildPlan File one is equivalent to two when:

  1. one and two have an equal number of BuildPlan objects.
  2. each object in one is equivalent to exactly one unique object in two.

Two BuildPlans, before and after, are equivalent when:

  1. All field values in before are equivalent to the same field in after
  2. Both 1 and 2 apply to nested objects, recursively.
  3. Field f is equivalent when before.f exactly equals after.f, except for: 3.1. Objects in the spec.artifacts list may appear in any arbitrary order. 3.2. The ordering of keys does not matter.
  4. Backwards compatibility behavior (controlled by isBackwardsCompatible): - When false: after and before must have exactly the same fields - When true: after may have additional fields that don't exist in before (e.g., new features added in a newer version) Example: before has {name: "x", version: "1.0"} after has {name: "x", version: "1.0", newFeature: "enabled"} This comparison passes when isBackwardsCompatible=true
  5. Fields in before must always be present in after (regardless of backwards compatibility mode).
  6. List type fields with a null value are equivalent to: 6.1. null values 6.2. empty values ([]) 6.2. a missing field

A BuildPlan File is valid when:

  1. Two or more identical objects exist in the same file. They must be treated as unique objects when comparing BuildPlan Files
  2. Two objects may have the same value for the metadata.name field.
  3. The kind field of all objects in the file stream is "BuildPlan"

Jump to

Keyboard shortcuts

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