pointer

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2025 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package pointer provides reflection-based helpers for working with pointers. These functions are useful for dynamically allocating and dereferencing variables in contexts like configuration loading or data mapping.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Alloc

func Alloc(rv reflect.Value)

Alloc allocates a new value for a nil pointer and sets the pointer to it.

This function causes a panic if rv is not a settable pointer.

func Deref

func Deref(rv reflect.Value) reflect.Value

Deref follows pointers until it reaches a non-pointer, allocating if nil.

If a nil pointer is encountered along the way, Deref will attempt to allocate a new value for it. If it encounters an un-settable nil pointer (e.g., one within an unexported struct field), it stops and returns that pointer to prevent a panic. The final, non-pointer value is returned.

Types

This section is empty.

Jump to

Keyboard shortcuts

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