【文件属性】:
文件名称:supermonkey:修补所有Go功能以进行测试
文件大小:75KB
文件格式:ZIP
更新时间:2021-03-19 22:36:54
Go
超级猴子
该库受启发,并使用了一些代码
介绍
无限制地修补所有功能,包括未导出的功能
警告:请在您的gcflags中添加-l或在要修补的func中添加//go:noinline 。
在测试中运行时
您应该在go mod项目下运行此lib并提供完整的项目路径
警告:使用go test -ldflags="-s=false" -gcflags="-l"启用符号表并禁用内联。
当不在测试中运行时
补丁专用功能
普通的
package main
import (
"fmt"
sm "github.com/cch123/supermonkey"
)
func main () {
fmt . Println ( "original function output:" )
heyHey ()
patchGuard := sm . Patch ( heyHey , func () {
fmt
【文件预览】:
supermonkey-master
----go.mod(155B)
----supermonkey.go(2KB)
----go.sum(282B)
----supermonkey_test.go(779B)
----examples()
--------main.go(160B)
--------patch_struct_method.go(647B)
--------patch_instance_func.go(534B)
--------patch_struct_method_symbol.go(644B)
--------patch_instance_func_symbol.go(509B)
--------patch_func_symbol.go(464B)
--------patch_func.go(420B)
----internal()
--------nm()
--------sys()
--------src()
--------xcoff()
--------objfile()
--------objabi()
--------goobj()
--------bouk()
----LICENSE(1KB)
----readme.md(4KB)