config

package
v0.93.0 Latest Latest
Warning

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

Go to latest
Published: May 28, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Merge

func Merge(dst, src any)

Merge copies non-zero fields from src into dst recursively.

dst and src must have the same concrete type (or identical field layout for structs). Mismatched types will cause a panic.

For each field in src:

  • Pointers: copied if non-nil (the pointed-to value is NOT inspected)
  • Interfaces: copied if non-nil
  • Strings: copied if non-empty
  • Numbers: copied if non-zero
  • Bools: ALWAYS copied (use *bool for optional bools)
  • Slices/maps: replaced if non-empty (element-level merging is NOT performed)
  • Structs: merged field-by-field recursively
  • Channels/funcs/arrays/unsafe pointers: intentionally skipped

Unexported struct fields are skipped.

dst must be a non-nil pointer to a struct. src must be a struct or pointer to struct. Either constraint violation causes Merge to panic.

Types

This section is empty.

Jump to

Keyboard shortcuts

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