hack

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package hack 对 go 系统包的 hack, 包含一些系统结构体的 copy,需要和每个 go 版本保持同步

Package hack 对 go 系统包的 hack, 包含一些系统结构体的 copy,需要和不同的 go 版本保持同步

Package hack 对 go 系统包的 hack, 包含一些系统结构体的 copy,需要和不同的 go 版本保持同步

Index

Constants

View Source
const InterceptCallerSkip = 5

InterceptCallerSkip 拦截器 callerskip

View Source
const (
	// MaxMethod 支持类型的最大方法数量
	MaxMethod = 999
)

Variables

View Source
var SignalsToIgnore = []os.Signal{os.Interrupt, syscall.SIGQUIT}

SignalsToIgnore ignore the quit signal

Functions

This section is empty.

Types

type Eface

type Eface struct {

	// Data 为 interface{}类型变量指向的 Iface 类型变量的地址
	Data unsafe.Pointer
	// contains filtered or unexported fields
}

Eface 接口结构

func UnpackEFace

func UnpackEFace(obj interface{}) *Eface

UnpackEFace 取出接口对象

type Func

type Func struct {
	CodePtr uintptr
}

Func convenience struct for modifying the underlying code pointer of a function value. The actual struct has other values, but always starts with a code pointer. keep async with runtime.Func

type Iface

type Iface struct {
	// Tab 为接口类型的方法表
	Tab *Itab
	// Data 为接口变量所持有的对实现类型接收体的地址
	Data unsafe.Pointer
}

Iface 接口结构 TODO 不同 go 版本兼容

type Itab

type Itab struct {
	// nolint
	Inter *uintptr
	// nolint
	Type *uintptr

	// Fun 为方法表映射、排序同接口方法定义的顺序
	Fun [MaxMethod]uintptr // variable sized. fun[0]==0 means Type does not implement Inter.
	// contains filtered or unexported fields
}

Itab keeps sync with runtime.itab TODO 不同 go 版本兼容 注意: 最多兼容99个方法数量以内的接口

type Value

type Value struct {
	Typ  *uintptr
	Ptr  unsafe.Pointer
	Flag uintptr
}

Value reflect.Value keep async with runtime.Value

Jump to

Keyboard shortcuts

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