usereflect

package
v0.2.7 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2025 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Overview

Package usereflect is used for testing.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ChangeSliceCapacityWithSliceHeader

func ChangeSliceCapacityWithSliceHeader() int

ChangeSliceCapacityWithSliceHeader uses reflect.SliceHeader to directly modify the capacity of a slice, in order to overwrite a func pointer.

func CopyValue

func CopyValue()

CopyValue copies a reflect.Value.

func CopyValueConcurrently

func CopyValueConcurrently()

CopyValueConcurrently does concurrent copies to a reflect.Value.

func CopyValueContainingStruct

func CopyValueContainingStruct()

CopyValueContainingStruct copies a struct containing a reflect.Value.

func CopyValueContainingStructViaPointer

func CopyValueContainingStructViaPointer()

CopyValueContainingStructViaPointer copies a struct containing a reflect.Value via a pointer.

func CopyValueEquivalent

func CopyValueEquivalent()

CopyValueEquivalent copies a value with a type equivalent to reflect.Value.

func CopyValueEquivalentViaPointer

func CopyValueEquivalentViaPointer()

CopyValueEquivalentViaPointer copies a value with a type equivalent to reflect.Value via a pointer.

func CopyValueGlobal

func CopyValueGlobal()

CopyValueGlobal copies a reflect.Value that is not a local variable.

func CopyValueInArray

func CopyValueInArray()

CopyValueInArray copies a reflect.Value in an array.

func CopyValueInArrayViaPointer

func CopyValueInArrayViaPointer()

CopyValueInArrayViaPointer copies a reflect.Value in an array via a pointer.

func CopyValueInCommaOk

func CopyValueInCommaOk()

CopyValueInCommaOk copies a reflect.Value using a "comma-ok" assignment.

func CopyValueInMultipleAssignment

func CopyValueInMultipleAssignment()

CopyValueInMultipleAssignment copies a reflect.Value using an assignment of multiple values.

func CopyValueInMultipleAssignmentViaPointer

func CopyValueInMultipleAssignmentViaPointer()

CopyValueInMultipleAssignmentViaPointer copies a reflect.Value via a pointer using an assignment of multiple values.

func CopyValueInStructField

func CopyValueInStructField()

CopyValueInStructField copies a reflect.Value field in a struct.

func CopyValueInStructFieldViaPointer

func CopyValueInStructFieldViaPointer()

CopyValueInStructFieldViaPointer copies a reflect.Value field in a struct via a pointer.

func CopyValueViaPointer

func CopyValueViaPointer()

CopyValueViaPointer copies a reflect.Value via a pointer.

func JSONUnmarshal

func JSONUnmarshal() int

JSONUnmarshal uses encoding/json to decode into a plain int.

func JSONUnmarshalTwo

func JSONUnmarshalTwo() int

JSONUnmarshalTwo uses encoding/json to decode into a type that has custom Unmarshal code.

func MakeFunc

func MakeFunc() int

MakeFunc sets a func variable to an interesting function using MakeFunc and (reflect.Value).Set.

func RangeValue

func RangeValue()

RangeValue copies to a reflect.Value using a range clause.

func RangeValueTwo

func RangeValueTwo()

RangeValueTwo does concurrent copies to a reflect.Value using range clauses.

func ReadValue

func ReadValue(x any) int

ReadValue reads a number from a value using reflect.

func TypeConfusionWithNewAt

func TypeConfusionWithNewAt() int

TypeConfusionWithNewAt modifies a func pointer using reflect.NewAt and (reflect.Value).Set.

func TypeConfusionWithNewAtTwo

func TypeConfusionWithNewAtTwo() int

TypeConfusionWithNewAtTwo modifies a func pointer using reflect.NewAt and (reflect.Value).Interface.

func TypeConfusionWithValueRace

func TypeConfusionWithValueRace() int

TypeConfusionWithValueRace uses concurrent writes to a reflect.Value to create a Value that refers to a func pointer but which has type uintptr.

func ValueSetFunc

func ValueSetFunc() int

ValueSetFunc uses (reflect.Value).Set to change a func variable to point to a different function, then calls it.

func ValueSetInt

func ValueSetInt() int

ValueSetInt uses (reflect.Value).Set to change an int.

func ValueSetInterface

func ValueSetInterface() int

ValueSetInterface uses (reflect.Value).Set to change an interface variable to a value with a different concrete type.

Types

This section is empty.

Jump to

Keyboard shortcuts

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