https://github.com/goplus/reflectx
Golang reflect package hack tools
https://github.com/goplus/reflectx
Last synced: 4 months ago
JSON representation
Golang reflect package hack tools
- Host: GitHub
- URL: https://github.com/goplus/reflectx
- Owner: goplus
- License: apache-2.0
- Created: 2020-11-14T14:02:20.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2025-02-08T14:42:44.000Z (4 months ago)
- Last Synced: 2025-02-08T15:30:37.664Z (4 months ago)
- Language: Assembly
- Size: 4.38 MB
- Stars: 30
- Watchers: 4
- Forks: 5
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# reflectx
Golang reflect package hack tools[](https://github.com/goplus/reflectx/actions/workflows/go114.yml)
[](https://github.com/goplus/reflectx/actions/workflows/go115.yml)
[](https://github.com/goplus/reflectx/actions/workflows/go116.yml)
[](https://github.com/goplus/reflectx/actions/workflows/go117.yml)
[](https://github.com/goplus/reflectx/actions/workflows/go118.yml)
[](https://github.com/goplus/reflectx/actions/workflows/go119.yml)
[](https://github.com/goplus/reflectx/actions/workflows/go120.yml)
[](https://github.com/goplus/reflectx/actions/workflows/go121.yml)
[](https://github.com/goplus/reflectx/actions/workflows/go122.yml)
[](https://github.com/goplus/reflectx/actions/workflows/go123.yml)### Build
- Go1.14 ~ Go1.22
`go build`
- Go1.23
`go build -ldflags="-checklinkname=0"`
### ABI
support ABI0 and ABIInternal
- ABI0 stack-based ABI
- ABIInternal [register-based Go calling convention proposal](https://golang.org/design/40724-register-calling)- Go1.17: amd64
- Go1.18: amd64 arm64 ppc64/ppc64le
- Go1.19~Go1.23: amd64 arm64 ppc64/ppc64le riscv64### Field
* reflectx.CanSet
* reflectx.Field
* reflectx.FieldByIndex
* reflectx.FieldByName
* reflectx.FieldByNameFunc### Named
* reflectx.StructOf(fs)
* reflectx.NamedTypeOf* SetUnderlying
* SetTypeName### Method
* reflectx.Method
* reflectx.MakeMethod* reflectx.NewMethodSet
* reflectx.SetMethodSet* reflectx.StructToMethodSet
### Interface
* reflectx.InterfaceOf
* reflectx.NamedInterfaceOf
* reflectx.NewInterfaceType
* reflectx.SetInterfaceType### Context
* reflectx.NewContext()### Method allocs
* allocs
```
import _ "github.com/goplus/reflectx/icall/icall[N]"
```
* install icall_gen
```
go get github.com/goplus/reflectx/cmd/icall_gen
```
```
icall_gen -o icall1024.go -pkg main -size 1024
```