Open muzig opened 1 year ago
goroutine 4 [running]: testing.tRunner.func1.2({0x100bcf660, 0x100c89988}) /Users//.gvm/gos/go1.18.5/src/testing/testing.go:1389 +0x1c8 testing.tRunner.func1() /Users//.gvm/gos/go1.18.5/src/testing/testing.go:1392 +0x384 panic({0x100bcf660, 0x100c89988}) /Users//.gvm/gos/go1.18.5/src/runtime/panic.go:838 +0x218 github.com/agiledragon/gomonkey/v2.modifyBinary(0x18?, {0x14000018108, 0x18, 0x8?}) /Users//Documents/tap4fun/c6/gs/vendor/github.com/agiledragon/gomonkey/v2/modify_binary_darwin.go:9 +0xac github.com/agiledragon/gomonkey/v2.replace(0x100bc3c60?, 0x100be5b78?) /Users//Documents/tap4fun/c6/gs/vendor/github.com/agiledragon/gomonkey/v2/patch.go:269 +0x78 github.com/agiledragon/gomonkey/v2.(Patches).ApplyCore(0x1400000c090, {0x100bc3c60?, 0x100be5b70?, 0x14000010480?}, {0x100bc3c60?, 0x100be5b78?, 0x100be68c8?}) /Users//Documents/tap4fun/c6/gs/vendor/github.com/agiledragon/gomonkey/v2/patch.go:213 +0x80 github.com/agiledragon/gomonkey/v2.(Patches).ApplyFunc(0x14000098ef8?, {0x100bc3c60?, 0x100be5b70?}, {0x100bc3c60, 0x100be5b78}) /Users//Documents/tap4fun/c6/gs/vendor/github.com/agiledragon/gomonkey/v2/patch.go:83 +0x74 github.com/agiledragon/gomonkey/v2.ApplyFunc({0x100bc3c60, 0x100be5b70}, {0x100bc3c60, 0x100be5b78}) /Users//Documents/tap4fun/c6/gs/vendor/github.com/agiledragon/gomonkey/v2/patch.go:25 +0x44 command-line-arguments.TestName(0x0?) /Users//Documents/tap4fun/c6/gs/tmp/main_test.go:20 +0x48 testing.tRunner(0x14000120340, 0x100be5b80) /Users//.gvm/gos/go1.18.5/src/testing/testing.go:1439 +0x118 created by testing.(*T).Run /Users//.gvm/gos/go1.18.5/src/testing/testing.go:1486 +0x2d8 FAIL command-line-arguments 0.085s FAIL
The test code:
` package main
import ( "testing"
"github.com/agiledragon/gomonkey/v2"
)
func TestName(t *testing.T) { Print() p := gomonkey.ApplyFunc(Print, func() { t.Logf("b") }) defer p.Reset()
Print()
}
func Print() { }
`
apple m1下arm64下应该是老问题了,参考:https://github.com/agiledragon/gomonkey/issues/70
goroutine 4 [running]: testing.tRunner.func1.2({0x100bcf660, 0x100c89988}) /Users//.gvm/gos/go1.18.5/src/testing/testing.go:1389 +0x1c8 testing.tRunner.func1() /Users//.gvm/gos/go1.18.5/src/testing/testing.go:1392 +0x384 panic({0x100bcf660, 0x100c89988}) /Users//.gvm/gos/go1.18.5/src/runtime/panic.go:838 +0x218 github.com/agiledragon/gomonkey/v2.modifyBinary(0x18?, {0x14000018108, 0x18, 0x8?}) /Users//Documents/tap4fun/c6/gs/vendor/github.com/agiledragon/gomonkey/v2/modify_binary_darwin.go:9 +0xac github.com/agiledragon/gomonkey/v2.replace(0x100bc3c60?, 0x100be5b78?) /Users//Documents/tap4fun/c6/gs/vendor/github.com/agiledragon/gomonkey/v2/patch.go:269 +0x78 github.com/agiledragon/gomonkey/v2.(Patches).ApplyCore(0x1400000c090, {0x100bc3c60?, 0x100be5b70?, 0x14000010480?}, {0x100bc3c60?, 0x100be5b78?, 0x100be68c8?}) /Users//Documents/tap4fun/c6/gs/vendor/github.com/agiledragon/gomonkey/v2/patch.go:213 +0x80 github.com/agiledragon/gomonkey/v2.(Patches).ApplyFunc(0x14000098ef8?, {0x100bc3c60?, 0x100be5b70?}, {0x100bc3c60, 0x100be5b78}) /Users//Documents/tap4fun/c6/gs/vendor/github.com/agiledragon/gomonkey/v2/patch.go:83 +0x74 github.com/agiledragon/gomonkey/v2.ApplyFunc({0x100bc3c60, 0x100be5b70}, {0x100bc3c60, 0x100be5b78}) /Users//Documents/tap4fun/c6/gs/vendor/github.com/agiledragon/gomonkey/v2/patch.go:25 +0x44 command-line-arguments.TestName(0x0?) /Users//Documents/tap4fun/c6/gs/tmp/main_test.go:20 +0x48 testing.tRunner(0x14000120340, 0x100be5b80) /Users//.gvm/gos/go1.18.5/src/testing/testing.go:1439 +0x118 created by testing.(*T).Run /Users//.gvm/gos/go1.18.5/src/testing/testing.go:1486 +0x2d8 FAIL command-line-arguments 0.085s FAIL
The test code:
` package main
import ( "testing"
)
func TestName(t *testing.T) { Print() p := gomonkey.ApplyFunc(Print, func() { t.Logf("b") }) defer p.Reset()
}
func Print() { }
`