Documentation
¶
Overview ¶
Package usereflect is used for testing.
Index ¶
- func ChangeSliceCapacityWithSliceHeader() int
- func CopyValue()
- func CopyValueConcurrently()
- func CopyValueContainingStruct()
- func CopyValueContainingStructViaPointer()
- func CopyValueEquivalent()
- func CopyValueEquivalentViaPointer()
- func CopyValueGlobal()
- func CopyValueInArray()
- func CopyValueInArrayViaPointer()
- func CopyValueInCommaOk()
- func CopyValueInMultipleAssignment()
- func CopyValueInMultipleAssignmentViaPointer()
- func CopyValueInStructField()
- func CopyValueInStructFieldViaPointer()
- func CopyValueViaPointer()
- func JSONUnmarshal() int
- func JSONUnmarshalTwo() int
- func MakeFunc() int
- func RangeValue()
- func RangeValueTwo()
- func ReadValue(x any) int
- func TypeConfusionWithNewAt() int
- func TypeConfusionWithNewAtTwo() int
- func TypeConfusionWithValueRace() int
- func ValueSetFunc() int
- func ValueSetInt() int
- func ValueSetInterface() int
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 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 RangeValueTwo ¶
func RangeValueTwo()
RangeValueTwo does concurrent copies to a reflect.Value using range clauses.
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 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.