ifix

package module
v0.0.0-...-0e84283 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2018 License: Apache-2.0 Imports: 6 Imported by: 0

README

ifix

Go runtime hotfix by loading plugin dynamic library.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Apply

func Apply(a interface{}, b []interface{}) []reflect.Value

func LoadDll

func LoadDll(libPath string, patchers map[string][]interface{}) error

在同一个Plugin目录下编译的so不管名字还是存放路径都会表示为同一个plugin,只能加载一次,改变Plugin目录即可进行第二次编译,然后改变 Case 1 (成功): 函数相同,分别是patch1/patch1.so 和patch2/patch2.so Case 2 (失败): 一次将两个库移动到patch/patch.so

func Unpatch

func Unpatch(target interface{}) bool

Unpatch removes any monkey patches on target returns whether target was patched in the first place

func UnpatchAll

func UnpatchAll()

UnpatchAll removes all applied monkeypatches

func UnpatchInstanceMethod

func UnpatchInstanceMethod(target reflect.Type, methodName string) bool

UnpatchInstanceMethod removes the monkey on methodName of the target returns whether it was patched in the first place

Types

type PatchGuard

type PatchGuard struct {
	// contains filtered or unexported fields
}

func Patch

func Patch(target, replacement interface{}) *PatchGuard

Patch replaces a function with another

func PatchInstanceMethod

func PatchInstanceMethod(target reflect.Type, methodName string, replacement interface{}) *PatchGuard

PatchInstanceMethod replaces an instance method methodName for the type target with replacement Replacement should expect the receiver (of type target) as the first argument

func (*PatchGuard) Restore

func (g *PatchGuard) Restore()

func (*PatchGuard) Unpatch

func (g *PatchGuard) Unpatch()

Directories

Path Synopsis
httpdemo
patch command

Jump to

Keyboard shortcuts

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