patchutil

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PatchValue

func PatchValue(v reflect.Value) reflect.Value

PatchValue enables assignment to an unexported struct field by clearing the internal read-only flags.

It takes a reflect.Value and returns the same Value after patching. This allows the caller to call Set on a Value that originally pointed to an unexported field.

WARNING:

  • This function relies on unsafe access to reflect.Value's internal 'flag' field.
  • It is highly version-dependent and may break in future Go releases.
  • Using this in production code is unsafe and may cause undefined behavior.
  • Only use this in controlled internal tools where performance or testing requires it.

Types

This section is empty.

Jump to

Keyboard shortcuts

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