kmp

package
v0.0.0-...-2cb4bbe Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package kmp wraps github.com/google/go-cmp with custom Comparers for frequently used kubernetes resources that have unexported fields.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CompareSetFields

func CompareSetFields(x, y interface{}, opts ...cmp.Option) ([]string, error)

CompareSetFields returns a list of field names that differ between x and y. Uses SafeEqual for comparison.

func SafeDiff

func SafeDiff(x, y interface{}, opts ...cmp.Option) (diff string, err error)

SafeDiff wraps cmp.Diff but recovers from panics and uses custom Comparers for: * k8s.io/apimachinery/pkg/api/resource.Quantity SafeDiff should be used instead of cmp.Diff in non-test code to protect the running process from crashing.

func SafeEqual

func SafeEqual(x, y interface{}, opts ...cmp.Option) (equal bool, err error)

SafeEqual wraps cmp.Equal but recovers from panics and uses custom Comparers for: * k8s.io/apimachinery/pkg/api/resource.Quantity SafeEqual should be used instead of cmp.Equal in non-test code to protect the running process from crashing.

func ShortDiff

func ShortDiff(prev, cur interface{}, opts ...cmp.Option) (string, error)

ShortDiff returns a zero-context, unified human-readable diff. Uses SafeEqual for comparison.

Types

This section is empty.

Jump to

Keyboard shortcuts

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