bypass

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2022 License: MIT Imports: 2 Imported by: 6

Documentation

Overview

Package bypass allows bypassing reflect restrictions on accessing unexported struct fields.

Deprecated: This package has become unmaintained, so it cannot offer any guarantees about whether the unsafe functionality it provides works correctly or even at all. If you need such functionality, you might be better off maintaining it yourself.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func UnsafeReflectValue

func UnsafeReflectValue(v reflect.Value) (rv reflect.Value)

UnsafeReflectValue converts the passed reflect.Value into a one that bypasses the typical safety restrictions preventing access to unaddressable and unexported data. It works by digging the raw pointer to the underlying value out of the protected value and generating a new unprotected (unsafe) reflect.Value to it.

This allows us to check for implementations of the Stringer and error interfaces to be used for pretty printing ordinarily unaddressable and inaccessible values such as unexported struct fields.

Types

This section is empty.

Jump to

Keyboard shortcuts

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