util

package
v1.32.0 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2026 License: Apache-2.0 Imports: 19 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Capitalize

func Capitalize(s string) string

func ColoredUnifiedDiff

func ColoredUnifiedDiff(from, to string, diffContextLines int) string

func EscapeForMarkdown

func EscapeForMarkdown(s string) string

EscapeForMarkdown escapes all Markdown special characters in the input string by prefixing them with a backslash.

func EscapeForMarkdownPreservingCodeSpans

func EscapeForMarkdownPreservingCodeSpans(s string) string

EscapeForMarkdownPreservingCodeSpans escapes Markdown special characters but preserves text within backtick code spans and indented code blocks.

func JSONPatchPathToJSONPath

func JSONPatchPathToJSONPath(path string) string

func MergeJSON

func MergeJSON(mergeA, toB []byte) (result []byte, changed bool, err error)

func NewRestyClient

func NewRestyClient(ctx context.Context) *resty.Client

func ParseProperties

func ParseProperties(ctx context.Context, input string) (map[string]any, error)

This is a pretty well-thought-out properties parser using a finite state machine (FSM). We should use it more, especially in annotations.

func SplitManifestsKeepingEmpty added in v1.27.0

func SplitManifestsKeepingEmpty(bigFile string) []string

func SubtractJSON

func SubtractJSON(fromA, subtractB []byte) (result []byte, changed bool, err error)

func Uint64ToInt

func Uint64ToInt(v uint64) int

Types

type MultiError

type MultiError struct {
	// contains filtered or unexported fields
}

MultiError collects multiple errors and formats them as a flat list. Nested MultiErrors wrapped with fmt.Errorf are automatically flattened, with wrapper prefixes prepended to each inner error.

func (*MultiError) Add

func (m *MultiError) Add(errs ...error) *MultiError

Add appends errors to the collection. Nil errors are ignored. Returns the MultiError for chaining.

func (*MultiError) Error

func (m *MultiError) Error() string

Error returns formatted error string. Single error is returned as-is. Multiple errors are formatted as "N errors occurred:\n * err1\n * err2". Nested MultiErrors are flattened with their wrapper chain as prefix.

func (*MultiError) HasErrors

func (m *MultiError) HasErrors() bool

func (*MultiError) OrNilIfNoErrs

func (m *MultiError) OrNilIfNoErrs() error

func (*MultiError) Unwrap

func (m *MultiError) Unwrap() []error

Jump to

Keyboard shortcuts

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