Help us shape the future of Go! Take the 2026 Go Developer Survey

patch

package
v0.100.0 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package patch applies RFC 6902 JSON Patch operations to a YAML release tree.

The patch itself is applied by a standard JSON Patch library, so serialization to JSON is required — which drops YAML custom tags (e.g. !lock), comments and key order. Those are restored from the original tree afterwards via yml.CopyMetadata. It also exposes a few node-level setters used for built-in transforms that must run before the JSON round-trip.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Apply

func Apply[T any](doc *T, ops []Op) (*T, error)

Apply applies a json patch.

Types

type Op

type Op struct {
	Op    string `json:"op" yaml:"op"`
	Path  string `json:"path" yaml:"path"`
	From  string `json:"from,omitempty" yaml:"from,omitempty"`
	Value any    `json:"value,omitempty" yaml:"value,omitempty"`
}

Op is a single RFC 6902 operation. Value is an arbitrary JSON value (set for add/replace); From is only set for move/copy.

Jump to

Keyboard shortcuts

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