agiledragon / gomonkey

gomonkey is a library to make monkey patching in unit tests easy
MIT License
2k stars 179 forks source link

tests not pass on M1/arm64 arch #99

Open MOON-CLJ opened 2 years ago

MOON-CLJ commented 2 years ago
gomonkey % pwd
/Users/chenlijun/go/src/github.com/agiledragon/gomonkey
gomonkey % docker run -it --rm -v /Users/chenlijun/go:/go --privileged golang bash     
root@0d9aff1c6cf8:/go# 
root@0d9aff1c6cf8:/go# cd src/github.com/agiledragon/gomonkey
root@0d9aff1c6cf8:/go/src/github.com/agiledragon/gomonkey# cd test/
root@0d9aff1c6cf8:/go/src/github.com/agiledragon/gomonkey/test# GOARCH=arm64 go test -gcflags=all=-l 
.....................x
Failures:

  * /go/src/github.com/agiledragon/gomonkey/test/apply_func_return_test.go 
  Line 35:
  Expected: 'hello golang'
  Actual:   'hello cpp'
  (Should be equal)
  goroutine 18 [running]:
  github.com/agiledragon/gomonkey/v2/test.TestApplyFuncReturn.func1.1()
    /go/src/github.com/agiledragon/gomonkey/test/apply_func_return_test.go:35 +0x2dc
  github.com/jtolds/gls.(*ContextManager).SetValues.func1(0x0)
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/context.go:97 +0x36c
  github.com/jtolds/gls.EnsureGoroutineId(0x40001086f0)
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/gid.go:19 +0xf8
  github.com/jtolds/gls.(*ContextManager).SetValues(0x4000104520, 0x4000108690, 0x400011e0d8)
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/context.go:63 +0x168
  github.com/agiledragon/gomonkey/v2/test.TestApplyFuncReturn.func1()
    /go/src/github.com/agiledragon/gomonkey/test/apply_func_return_test.go:17 +0x64
  github.com/jtolds/gls.(*ContextManager).SetValues.func1(0x0)
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/context.go:97 +0x36c
  github.com/jtolds/gls.EnsureGoroutineId.func1()
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/gid.go:24 +0x2c
  github.com/jtolds/gls._m(0x4000058d98?, 0x178978?)
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/stack_tags.go:108 +0x2c
  github.com/jtolds/gls.github_com_jtolds_gls_markS(0x31fb01?, 0x4000058d80?)
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/stack_tags.go:56 +0x20
  github.com/jtolds/gls.addStackTag(0x31fb20?, 0x3205e0?)
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/stack_tags.go:49 +0x24
  github.com/jtolds/gls.EnsureGoroutineId(0x40001085a0)
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/gid.go:24 +0xd0
  github.com/jtolds/gls.(*ContextManager).SetValues(0x4000104520, 0x4000108540, 0x4000148040)
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/context.go:63 +0x168
  github.com/agiledragon/gomonkey/v2/test.TestApplyFuncReturn(0x0?)
    /go/src/github.com/agiledragon/gomonkey/test/apply_func_return_test.go:15 +0x78
  testing.tRunner(0x4000113040, 0x1eed00)
    /usr/local/go/src/testing/testing.go:1439 +0x118
  created by testing.(*T).Run
    /usr/local/go/src/testing/testing.go:1486 +0x300

22 total assertions

--- FAIL: TestApplyFuncReturn (0.00s)
..........E
Errors:

  * /go/src/github.com/agiledragon/gomonkey/test/apply_func_seq_test.go 
  Line 65: - double seq is less than call seq 
  goroutine 19 [running]:
  panic({0x1a5220, 0x1fbb20})
    /usr/local/go/src/runtime/panic.go:838 +0x210
  github.com/agiledragon/gomonkey/v2.getDoubleFunc.func1({0x1ac080?, 0x0?, 0x1?})
    /go/src/github.com/agiledragon/gomonkey/patch.go:308 +0xc4
  github.com/agiledragon/gomonkey/v2/test.TestApplyFuncSeq.func1.3()
    /go/src/github.com/agiledragon/gomonkey/test/apply_func_seq_test.go:65 +0x1a0
  github.com/jtolds/gls.(*ContextManager).SetValues.func1(0x0)
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/context.go:97 +0x3
agiledragon commented 10 months ago

v2.11.0 has been released!

MOON-CLJ commented 10 months ago

test still not success

chenlijun05@MBA-FGW0YMQ6LX-0335 gomonkey % docker run -it --rm -v /Users/chenlijun05/go:/go --privileged golang bash  
root@a8e7d44bfc3c:/go# cd src/github.com/agiledragon/gomonkey
root@a8e7d44bfc3c:/go/src/github.com/agiledragon/gomonkey# cd test/
root@a8e7d44bfc3c:/go/src/github.com/agiledragon/gomonkey/test# GOARCH=arm64 go test -gcflags=all=-l 
........................................
40 total assertions

...............
55 total assertions

.............x.......
Failures:

  * /go/src/github.com/agiledragon/gomonkey/test/apply_func_test.go 
  Line 86:
  Expected: 'patch2'
  Actual:   'patch1'
  (Should be equal)
  goroutine 23 [running]:
  github.com/agiledragon/gomonkey/v2/test.TestApplyFunc.func1.5()
    /go/src/github.com/agiledragon/gomonkey/test/apply_func_test.go:86 +0x1b0
  github.com/jtolds/gls.(*ContextManager).SetValues.func1(0x0)
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/context.go:97 +0x330
  github.com/jtolds/gls.EnsureGoroutineId(0x4000010f30)
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/gid.go:19 +0xe8
  github.com/jtolds/gls.(*ContextManager).SetValues(0x400008a500, 0x4000010ed0, 0x400000c660)
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/context.go:63 +0x150
  github.com/agiledragon/gomonkey/v2/test.TestApplyFunc.func1()
    /go/src/github.com/agiledragon/gomonkey/test/apply_func_test.go:73 +0x180
  github.com/jtolds/gls.(*ContextManager).SetValues.func1(0x0)
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/context.go:97 +0x330
  github.com/jtolds/gls.EnsureGoroutineId.func1()
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/gid.go:24 +0x2c
  github.com/jtolds/gls._m(0x4000085d98?, 0x19a01c?)
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/stack_tags.go:108 +0x28
  github.com/jtolds/gls.github_com_jtolds_gls_markS(0x37f001?, 0x4000085d80?)
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/stack_tags.go:56 +0x1c
  github.com/jtolds/gls.addStackTag(0x37f060?, 0x40000106c0?)
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/stack_tags.go:49 +0x20
  github.com/jtolds/gls.EnsureGoroutineId(0x40000106c0)
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/gid.go:24 +0xc0
  github.com/jtolds/gls.(*ContextManager).SetValues(0x400008a500, 0x4000010660, 0x400001c0e0)
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/context.go:63 +0x150
  github.com/agiledragon/gomonkey/v2/test.TestApplyFunc(0x0?)
    /go/src/github.com/agiledragon/gomonkey/test/apply_func_test.go:17 +0x74
  testing.tRunner(0x4000003860, 0x21c458)
    /usr/local/go/src/testing/testing.go:1595 +0xf8
  created by testing.(*T).Run in goroutine 1
    /usr/local/go/src/testing/testing.go:1648 +0x318

76 total assertions

--- FAIL: TestApplyFunc (0.00s)
........................................
116 total assertions

...............
131 total assertions

...
134 total assertions

..
136 total assertions

...x..
Failures:

  * /go/src/github.com/agiledragon/gomonkey/test/apply_interface_reused_test.go 
  Line 44:
  Expected: 'hello cpp'
  Actual:   'hello interface'
  (Should be equal)
  goroutine 28 [running]:
  github.com/agiledragon/gomonkey/v2/test.TestApplyInterfaceReused.func1.3()
    /go/src/github.com/agiledragon/gomonkey/test/apply_interface_reused_test.go:44 +0x2e0
  github.com/jtolds/gls.(*ContextManager).SetValues.func1(0x0)
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/context.go:97 +0x330
  github.com/jtolds/gls.EnsureGoroutineId(0x400008de60)
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/gid.go:19 +0xe8
  github.com/jtolds/gls.(*ContextManager).SetValues(0x400008a500, 0x400008de00, 0x400000dd88)
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/context.go:63 +0x150
  github.com/agiledragon/gomonkey/v2/test.TestApplyInterfaceReused.func1()
    /go/src/github.com/agiledragon/gomonkey/test/apply_interface_reused_test.go:32 +0x234
  github.com/jtolds/gls.(*ContextManager).SetValues.func1(0x0)
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/context.go:97 +0x330
  github.com/jtolds/gls.EnsureGoroutineId.func1()
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/gid.go:24 +0x2c
  github.com/jtolds/gls._m(0x4000085d98?, 0x19a01c?)
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/stack_tags.go:108 +0x28
  github.com/jtolds/gls.github_com_jtolds_gls_markS(0x37f001?, 0x4000085d80?)
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/stack_tags.go:56 +0x1c
  github.com/jtolds/gls.addStackTag(0x37f060?, 0x400008d890?)
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/stack_tags.go:49 +0x20
  github.com/jtolds/gls.EnsureGoroutineId(0x400008d890)
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/gid.go:24 +0xc0
  github.com/jtolds/gls.(*ContextManager).SetValues(0x400008a500, 0x400008d830, 0x400001c420)
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/context.go:63 +0x150
  github.com/agiledragon/gomonkey/v2/test.TestApplyInterfaceReused(0x4000101860)
    /go/src/github.com/agiledragon/gomonkey/test/apply_interface_reused_test.go:14 +0x98
  testing.tRunner(0x4000101860, 0x21c490)
    /usr/local/go/src/testing/testing.go:1595 +0xf8
  created by testing.(*T).Run in goroutine 1
    /usr/local/go/src/testing/testing.go:1648 +0x318

142 total assertions

--- FAIL: TestApplyInterfaceReused (0.00s)
Slice: Add elem: 1 succ
.Slice: Add elem: 1 already exist
xSlice: Add elem: 2 succ
.Slice: Add elem: 1 already exist
.Slice: Remove elem: 2 succ
.xSlice: Add elem: 3 succ
.Slice: Add elem: 2 succ
xSlice: Remove elem: 3 succ
Slice: Add elem: 4 succ
...Slice: Remove elem: 1 succ
xSlice: Remove elem: 4 succ
Slice: Append elem: [1 2 3] succ
.Slice: Append elem: [4 5 6] succ
x
Failures:

  * /go/src/github.com/agiledragon/gomonkey/test/apply_method_func_test.go 
  Line 27:
  Expected: '<nil>'
  Actual:   'elem already exist'
  (Should be equal)
  goroutine 29 [running]:
  github.com/agiledragon/gomonkey/v2/test.TestApplyMethodFunc.func1.1()
    /go/src/github.com/agiledragon/gomonkey/test/apply_method_func_test.go:27 +0x118
  github.com/jtolds/gls.(*ContextManager).SetValues.func1(0x0)
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/context.go:97 +0x330
  github.com/jtolds/gls.EnsureGoroutineId(0x400015c4b0)
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/gid.go:19 +0xe8
  github.com/jtolds/gls.(*ContextManager).SetValues(0x400008a500, 0x400015c450, 0x400000df50)
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/context.go:63 +0x150
  github.com/agiledragon/gomonkey/v2/test.TestApplyMethodFunc.func1()
    /go/src/github.com/agiledragon/gomonkey/test/apply_method_func_test.go:19 +0xb4
  github.com/jtolds/gls.(*ContextManager).SetValues.func1(0x0)
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/context.go:97 +0x330
  github.com/jtolds/gls.EnsureGoroutineId.func1()
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/gid.go:24 +0x2c
  github.com/jtolds/gls._m(0x4000085d98?, 0x19a01c?)
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/stack_tags.go:108 +0x28
  github.com/jtolds/gls.github_com_jtolds_gls_markS(0x37f001?, 0x4000085d80?)
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/stack_tags.go:56 +0x1c
  github.com/jtolds/gls.addStackTag(0x37f060?, 0x400015c360?)
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/stack_tags.go:49 +0x20
  github.com/jtolds/gls.EnsureGoroutineId(0x400015c360)
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/gid.go:24 +0xc0
  github.com/jtolds/gls.(*ContextManager).SetValues(0x400008a500, 0x400015c300, 0x400001c640)
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/context.go:63 +0x150
  github.com/agiledragon/gomonkey/v2/test.TestApplyMethodFunc(0x40000a04e0)
    /go/src/github.com/agiledragon/gomonkey/test/apply_method_func_test.go:18 +0xf4
  testing.tRunner(0x40000a04e0, 0x21c4a0)
    /usr/local/go/src/testing/testing.go:1595 +0xf8
  created by testing.(*T).Run in goroutine 1
    /usr/local/go/src/testing/testing.go:1648 +0x318

  * /go/src/github.com/agiledragon/gomonkey/test/apply_method_func_test.go 
  Line 44:
  Expected: '0'
  Actual:   '1'
  (Should be equal)
  goroutine 29 [running]:
  github.com/agiledragon/gomonkey/v2/test.TestApplyMethodFunc.func1.2()
    /go/src/github.com/agiledragon/gomonkey/test/apply_method_func_test.go:44 +0x1e8
  github.com/jtolds/gls.(*ContextManager).SetValues.func1(0x0)
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/context.go:97 +0x330
  github.com/jtolds/gls.EnsureGoroutineId(0x400015c930)
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/gid.go:19 +0xe8
  github.com/jtolds/gls.(*ContextManager).SetValues(0x400008a500, 0x400015c8d0, 0x4000094180)
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/context.go:63 +0x150
  github.com/agiledragon/gomonkey/v2/test.TestApplyMethodFunc.func1()
    /go/src/github.com/agiledragon/gomonkey/test/apply_method_func_test.go:33 +0x140
  github.com/jtolds/gls.(*ContextManager).SetValues.func1(0x0)
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/context.go:97 +0x330
  github.com/jtolds/gls.EnsureGoroutineId.func1()
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/gid.go:24 +0x2c
  github.com/jtolds/gls._m(0x4000085d98?, 0x19a01c?)
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/stack_tags.go:108 +0x28
  github.com/jtolds/gls.github_com_jtolds_gls_markS(0x37f001?, 0x4000085d80?)
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/stack_tags.go:56 +0x1c
  github.com/jtolds/gls.addStackTag(0x37f060?, 0x400015c360?)
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/stack_tags.go:49 +0x20
  github.com/jtolds/gls.EnsureGoroutineId(0x400015c360)
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/gid.go:24 +0xc0
  github.com/jtolds/gls.(*ContextManager).SetValues(0x400008a500, 0x400015c300, 0x400001c640)
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/context.go:63 +0x150
  github.com/agiledragon/gomonkey/v2/test.TestApplyMethodFunc(0x40000a04e0)
    /go/src/github.com/agiledragon/gomonkey/test/apply_method_func_test.go:18 +0xf4
  testing.tRunner(0x40000a04e0, 0x21c4a0)
    /usr/local/go/src/testing/testing.go:1595 +0xf8
  created by testing.(*T).Run in goroutine 1
    /usr/local/go/src/testing/testing.go:1648 +0x318

  * /go/src/github.com/agiledragon/gomonkey/test/apply_method_func_test.go 
  Line 59:
  Expected: 'elem already exist'
  Actual:   '<nil>'
  (Should be equal)
  goroutine 29 [running]:
  github.com/agiledragon/gomonkey/v2/test.TestApplyMethodFunc.func1.3()
    /go/src/github.com/agiledragon/gomonkey/test/apply_method_func_test.go:59 +0x1a0
  github.com/jtolds/gls.(*ContextManager).SetValues.func1(0x0)
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/context.go:97 +0x330
  github.com/jtolds/gls.EnsureGoroutineId(0x400015cba0)
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/gid.go:19 +0xe8
  github.com/jtolds/gls.(*ContextManager).SetValues(0x400008a500, 0x400015cb40, 0x40000942b8)
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/context.go:63 +0x150
  github.com/agiledragon/gomonkey/v2/test.TestApplyMethodFunc.func1()
    /go/src/github.com/agiledragon/gomonkey/test/apply_method_func_test.go:47 +0x1cc
  github.com/jtolds/gls.(*ContextManager).SetValues.func1(0x0)
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/context.go:97 +0x330
  github.com/jtolds/gls.EnsureGoroutineId.func1()
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/gid.go:24 +0x2c
  github.com/jtolds/gls._m(0x4000085d98?, 0x19a01c?)
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/stack_tags.go:108 +0x28
  github.com/jtolds/gls.github_com_jtolds_gls_markS(0x37f001?, 0x4000085d80?)
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/stack_tags.go:56 +0x1c
  github.com/jtolds/gls.addStackTag(0x37f060?, 0x400015c360?)
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/stack_tags.go:49 +0x20
  github.com/jtolds/gls.EnsureGoroutineId(0x400015c360)
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/gid.go:24 +0xc0
  github.com/jtolds/gls.(*ContextManager).SetValues(0x400008a500, 0x400015c300, 0x400001c640)
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/context.go:63 +0x150
  github.com/agiledragon/gomonkey/v2/test.TestApplyMethodFunc(0x40000a04e0)
    /go/src/github.com/agiledragon/gomonkey/test/apply_method_func_test.go:18 +0xf4
  testing.tRunner(0x40000a04e0, 0x21c4a0)
    /usr/local/go/src/testing/testing.go:1595 +0xf8
  created by testing.(*T).Run in goroutine 1
    /usr/local/go/src/testing/testing.go:1648 +0x318

  * /go/src/github.com/agiledragon/gomonkey/test/apply_method_func_test.go 
  Line 81:
  Expected: 'elem not exist'
  Actual:   '<nil>'
  (Should be equal)
  goroutine 29 [running]:
  github.com/agiledragon/gomonkey/v2/test.TestApplyMethodFunc.func1.4()
    /go/src/github.com/agiledragon/gomonkey/test/apply_method_func_test.go:81 +0x28c
  github.com/jtolds/gls.(*ContextManager).SetValues.func1(0x0)
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/context.go:97 +0x330
  github.com/jtolds/gls.EnsureGoroutineId(0x400015ce70)
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/gid.go:19 +0xe8
  github.com/jtolds/gls.(*ContextManager).SetValues(0x400008a500, 0x400015ce10, 0x40000943c0)
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/context.go:63 +0x150
  github.com/agiledragon/gomonkey/v2/test.TestApplyMethodFunc.func1()
    /go/src/github.com/agiledragon/gomonkey/test/apply_method_func_test.go:66 +0x258
  github.com/jtolds/gls.(*ContextManager).SetValues.func1(0x0)
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/context.go:97 +0x330
  github.com/jtolds/gls.EnsureGoroutineId.func1()
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/gid.go:24 +0x2c
  github.com/jtolds/gls._m(0x4000085d98?, 0x19a01c?)
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/stack_tags.go:108 +0x28
  github.com/jtolds/gls.github_com_jtolds_gls_markS(0x37f001?, 0x4000085d80?)
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/stack_tags.go:56 +0x1c
  github.com/jtolds/gls.addStackTag(0x37f060?, 0x400015c360?)
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/stack_tags.go:49 +0x20
  github.com/jtolds/gls.EnsureGoroutineId(0x400015c360)
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/gid.go:24 +0xc0
  github.com/jtolds/gls.(*ContextManager).SetValues(0x400008a500, 0x400015c300, 0x400001c640)
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/context.go:63 +0x150
  github.com/agiledragon/gomonkey/v2/test.TestApplyMethodFunc(0x40000a04e0)
    /go/src/github.com/agiledragon/gomonkey/test/apply_method_func_test.go:18 +0xf4
  testing.tRunner(0x40000a04e0, 0x21c4a0)
    /usr/local/go/src/testing/testing.go:1595 +0xf8
  created by testing.(*T).Run in goroutine 1
    /usr/local/go/src/testing/testing.go:1648 +0x318

  * /go/src/github.com/agiledragon/gomonkey/test/apply_method_func_test.go 
  Line 95:
  Expected: '0'
  Actual:   '3'
  (Should be equal)
  goroutine 29 [running]:
  github.com/agiledragon/gomonkey/v2/test.TestApplyMethodFunc.func1.5()
    /go/src/github.com/agiledragon/gomonkey/test/apply_method_func_test.go:95 +0x1b8
  github.com/jtolds/gls.(*ContextManager).SetValues.func1(0x0)
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/context.go:97 +0x330
  github.com/jtolds/gls.EnsureGoroutineId(0x400015d0e0)
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/gid.go:19 +0xe8
  github.com/jtolds/gls.(*ContextManager).SetValues(0x400008a500, 0x400015d080, 0x40000944f8)
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/context.go:63 +0x150
  github.com/agiledragon/gomonkey/v2/test.TestApplyMethodFunc.func1()
    /go/src/github.com/agiledragon/gomonkey/test/apply_method_func_test.go:86 +0x2e4
  github.com/jtolds/gls.(*ContextManager).SetValues.func1(0x0)
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/context.go:97 +0x330
  github.com/jtolds/gls.EnsureGoroutineId.func1()
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/gid.go:24 +0x2c
  github.com/jtolds/gls._m(0x4000085d98?, 0x19a01c?)
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/stack_tags.go:108 +0x28
  github.com/jtolds/gls.github_com_jtolds_gls_markS(0x37f001?, 0x4000085d80?)
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/stack_tags.go:56 +0x1c
  github.com/jtolds/gls.addStackTag(0x37f060?, 0x400015c360?)
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/stack_tags.go:49 +0x20
  github.com/jtolds/gls.EnsureGoroutineId(0x400015c360)
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/gid.go:24 +0xc0
  github.com/jtolds/gls.(*ContextManager).SetValues(0x400008a500, 0x400015c300, 0x400001c640)
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/context.go:63 +0x150
  github.com/agiledragon/gomonkey/v2/test.TestApplyMethodFunc(0x40000a04e0)
    /go/src/github.com/agiledragon/gomonkey/test/apply_method_func_test.go:18 +0xf4
  testing.tRunner(0x40000a04e0, 0x21c4a0)
    /usr/local/go/src/testing/testing.go:1595 +0xf8
  created by testing.(*T).Run in goroutine 1
    /usr/local/go/src/testing/testing.go:1648 +0x318

156 total assertions

--- FAIL: TestApplyMethodFunc (0.00s)
.....................x
Failures:

  * /go/src/github.com/agiledragon/gomonkey/test/apply_method_return_test.go 
  Line 34:
  Expected: 'hello golang'
  Actual:   'hello cpp'
  (Should be equal)
  goroutine 30 [running]:
  github.com/agiledragon/gomonkey/v2/test.TestApplyMethodReturn.func1.1()
    /go/src/github.com/agiledragon/gomonkey/test/apply_method_return_test.go:34 +0x2a4
  github.com/jtolds/gls.(*ContextManager).SetValues.func1(0x0)
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/context.go:97 +0x330
  github.com/jtolds/gls.EnsureGoroutineId(0x400015d590)
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/gid.go:19 +0xe8
  github.com/jtolds/gls.(*ContextManager).SetValues(0x400008a500, 0x400015d530, 0x4000094648)
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/context.go:63 +0x150
  github.com/agiledragon/gomonkey/v2/test.TestApplyMethodReturn.func1()
    /go/src/github.com/agiledragon/gomonkey/test/apply_method_return_test.go:18 +0x9c
  github.com/jtolds/gls.(*ContextManager).SetValues.func1(0x0)
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/context.go:97 +0x330
  github.com/jtolds/gls.EnsureGoroutineId.func1()
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/gid.go:24 +0x2c
  github.com/jtolds/gls._m(0x4000085d98?, 0x19a01c?)
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/stack_tags.go:108 +0x28
  github.com/jtolds/gls.github_com_jtolds_gls_markS(0x37f001?, 0x4000085d80?)
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/stack_tags.go:56 +0x1c
  github.com/jtolds/gls.addStackTag(0x37f060?, 0x400015d440?)
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/stack_tags.go:49 +0x20
  github.com/jtolds/gls.EnsureGoroutineId(0x400015d440)
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/gid.go:24 +0xc0
  github.com/jtolds/gls.(*ContextManager).SetValues(0x400008a500, 0x400015d3e0, 0x400001c8a0)
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/context.go:63 +0x150
  github.com/agiledragon/gomonkey/v2/test.TestApplyMethodReturn(0x40000a1d40)
    /go/src/github.com/agiledragon/gomonkey/test/apply_method_return_test.go:17 +0x98
  testing.tRunner(0x40000a1d40, 0x21c4a8)
    /usr/local/go/src/testing/testing.go:1595 +0xf8
  created by testing.(*T).Run in goroutine 1
    /usr/local/go/src/testing/testing.go:1648 +0x318

178 total assertions

--- FAIL: TestApplyMethodReturn (0.00s)
...............
193 total assertions

Slice: Add elem: 1 succ
.Slice: Add elem: 1 already exist
xSlice: Add elem: 2 succ
.Slice: Add elem: 1 already exist
.Slice: Remove elem: 2 succ
.xSlice: Add elem: 3 succ
.Slice: Add elem: 2 succ
xSlice: Remove elem: 3 succ
Slice: Add elem: 4 succ
...Slice: Remove elem: 1 succ
xSlice: Remove elem: 4 succ

Failures:

  * /go/src/github.com/agiledragon/gomonkey/test/apply_method_test.go 
  Line 24:
  Expected: '<nil>'
  Actual:   'elem already exist'
  (Should be equal)
  goroutine 32 [running]:
  github.com/agiledragon/gomonkey/v2/test.TestApplyMethod.func1.1()
    /go/src/github.com/agiledragon/gomonkey/test/apply_method_test.go:24 +0x118
  github.com/jtolds/gls.(*ContextManager).SetValues.func1(0x0)
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/context.go:97 +0x330
  github.com/jtolds/gls.EnsureGoroutineId(0x40002068a0)
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/gid.go:19 +0xe8
  github.com/jtolds/gls.(*ContextManager).SetValues(0x400008a500, 0x4000206840, 0x4000094ee8)
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/context.go:63 +0x150
  github.com/agiledragon/gomonkey/v2/test.TestApplyMethod.func1()
    /go/src/github.com/agiledragon/gomonkey/test/apply_method_test.go:16 +0xb4
  github.com/jtolds/gls.(*ContextManager).SetValues.func1(0x0)
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/context.go:97 +0x330
  github.com/jtolds/gls.EnsureGoroutineId.func1()
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/gid.go:24 +0x2c
  github.com/jtolds/gls._m(0x4000085d98?, 0x19a01c?)
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/stack_tags.go:108 +0x28
  github.com/jtolds/gls.github_com_jtolds_gls_markS(0x37f001?, 0x4000085d80?)
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/stack_tags.go:56 +0x1c
  github.com/jtolds/gls.addStackTag(0x37f060?, 0x4000206750?)
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/stack_tags.go:49 +0x20
  github.com/jtolds/gls.EnsureGoroutineId(0x4000206750)
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/gid.go:24 +0xc0
  github.com/jtolds/gls.(*ContextManager).SetValues(0x400008a500, 0x40002066f0, 0x400001cbe0)
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/context.go:63 +0x150
  github.com/agiledragon/gomonkey/v2/test.TestApplyMethod(0x40001e6820)
    /go/src/github.com/agiledragon/gomonkey/test/apply_method_test.go:14 +0xf4
  testing.tRunner(0x40001e6820, 0x21c498)
    /usr/local/go/src/testing/testing.go:1595 +0xf8
  created by testing.(*T).Run in goroutine 1
    /usr/local/go/src/testing/testing.go:1648 +0x318

  * /go/src/github.com/agiledragon/gomonkey/test/apply_method_test.go 
  Line 41:
  Expected: '0'
  Actual:   '1'
  (Should be equal)
  goroutine 32 [running]:
  github.com/agiledragon/gomonkey/v2/test.TestApplyMethod.func1.2()
    /go/src/github.com/agiledragon/gomonkey/test/apply_method_test.go:41 +0x1e8
  github.com/jtolds/gls.(*ContextManager).SetValues.func1(0x0)
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/context.go:97 +0x330
  github.com/jtolds/gls.EnsureGoroutineId(0x4000206b40)
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/gid.go:19 +0xe8
  github.com/jtolds/gls.(*ContextManager).SetValues(0x400008a500, 0x4000206ae0, 0x4000094fd8)
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/context.go:63 +0x150
  github.com/agiledragon/gomonkey/v2/test.TestApplyMethod.func1()
    /go/src/github.com/agiledragon/gomonkey/test/apply_method_test.go:30 +0x140
  github.com/jtolds/gls.(*ContextManager).SetValues.func1(0x0)
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/context.go:97 +0x330
  github.com/jtolds/gls.EnsureGoroutineId.func1()
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/gid.go:24 +0x2c
  github.com/jtolds/gls._m(0x4000085d98?, 0x19a01c?)
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/stack_tags.go:108 +0x28
  github.com/jtolds/gls.github_com_jtolds_gls_markS(0x37f001?, 0x4000085d80?)
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/stack_tags.go:56 +0x1c
  github.com/jtolds/gls.addStackTag(0x37f060?, 0x4000206750?)
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/stack_tags.go:49 +0x20
  github.com/jtolds/gls.EnsureGoroutineId(0x4000206750)
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/gid.go:24 +0xc0
  github.com/jtolds/gls.(*ContextManager).SetValues(0x400008a500, 0x40002066f0, 0x400001cbe0)
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/context.go:63 +0x150
  github.com/agiledragon/gomonkey/v2/test.TestApplyMethod(0x40001e6820)
    /go/src/github.com/agiledragon/gomonkey/test/apply_method_test.go:14 +0xf4
  testing.tRunner(0x40001e6820, 0x21c498)
    /usr/local/go/src/testing/testing.go:1595 +0xf8
  created by testing.(*T).Run in goroutine 1
    /usr/local/go/src/testing/testing.go:1648 +0x318

  * /go/src/github.com/agiledragon/gomonkey/test/apply_method_test.go 
  Line 56:
  Expected: 'elem already exist'
  Actual:   '<nil>'
  (Should be equal)
  goroutine 32 [running]:
  github.com/agiledragon/gomonkey/v2/test.TestApplyMethod.func1.3()
    /go/src/github.com/agiledragon/gomonkey/test/apply_method_test.go:56 +0x1a0
  github.com/jtolds/gls.(*ContextManager).SetValues.func1(0x0)
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/context.go:97 +0x330
  github.com/jtolds/gls.EnsureGoroutineId(0x4000206d50)
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/gid.go:19 +0xe8
  github.com/jtolds/gls.(*ContextManager).SetValues(0x400008a500, 0x4000206cf0, 0x40000950f8)
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/context.go:63 +0x150
  github.com/agiledragon/gomonkey/v2/test.TestApplyMethod.func1()
    /go/src/github.com/agiledragon/gomonkey/test/apply_method_test.go:44 +0x1cc
  github.com/jtolds/gls.(*ContextManager).SetValues.func1(0x0)
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/context.go:97 +0x330
  github.com/jtolds/gls.EnsureGoroutineId.func1()
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/gid.go:24 +0x2c
  github.com/jtolds/gls._m(0x4000085d98?, 0x19a01c?)
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/stack_tags.go:108 +0x28
  github.com/jtolds/gls.github_com_jtolds_gls_markS(0x37f001?, 0x4000085d80?)
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/stack_tags.go:56 +0x1c
  github.com/jtolds/gls.addStackTag(0x37f060?, 0x4000206750?)
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/stack_tags.go:49 +0x20
  github.com/jtolds/gls.EnsureGoroutineId(0x4000206750)
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/gid.go:24 +0xc0
  github.com/jtolds/gls.(*ContextManager).SetValues(0x400008a500, 0x40002066f0, 0x400001cbe0)
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/context.go:63 +0x150
  github.com/agiledragon/gomonkey/v2/test.TestApplyMethod(0x40001e6820)
    /go/src/github.com/agiledragon/gomonkey/test/apply_method_test.go:14 +0xf4
  testing.tRunner(0x40001e6820, 0x21c498)
    /usr/local/go/src/testing/testing.go:1595 +0xf8
  created by testing.(*T).Run in goroutine 1
    /usr/local/go/src/testing/testing.go:1648 +0x318

  * /go/src/github.com/agiledragon/gomonkey/test/apply_method_test.go 
  Line 78:
  Expected: 'elem not exist'
  Actual:   '<nil>'
  (Should be equal)
  goroutine 32 [running]:
  github.com/agiledragon/gomonkey/v2/test.TestApplyMethod.func1.4()
    /go/src/github.com/agiledragon/gomonkey/test/apply_method_test.go:78 +0x28c
  github.com/jtolds/gls.(*ContextManager).SetValues.func1(0x0)
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/context.go:97 +0x330
  github.com/jtolds/gls.EnsureGoroutineId(0x4000206f60)
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/gid.go:19 +0xe8
  github.com/jtolds/gls.(*ContextManager).SetValues(0x400008a500, 0x4000206f00, 0x40000951e8)
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/context.go:63 +0x150
  github.com/agiledragon/gomonkey/v2/test.TestApplyMethod.func1()
    /go/src/github.com/agiledragon/gomonkey/test/apply_method_test.go:63 +0x258
  github.com/jtolds/gls.(*ContextManager).SetValues.func1(0x0)
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/context.go:97 +0x330
  github.com/jtolds/gls.EnsureGoroutineId.func1()
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/gid.go:24 +0x2c
  github.com/jtolds/gls._m(0x4000085d98?, 0x19a01c?)
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/stack_tags.go:108 +0x28
  github.com/jtolds/gls.github_com_jtolds_gls_markS(0x37f001?, 0x4000085d80?)
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/stack_tags.go:56 +0x1c
  github.com/jtolds/gls.addStackTag(0x37f060?, 0x4000206750?)
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/stack_tags.go:49 +0x20
  github.com/jtolds/gls.EnsureGoroutineId(0x4000206750)
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/gid.go:24 +0xc0
  github.com/jtolds/gls.(*ContextManager).SetValues(0x400008a500, 0x40002066f0, 0x400001cbe0)
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/context.go:63 +0x150
  github.com/agiledragon/gomonkey/v2/test.TestApplyMethod(0x40001e6820)
    /go/src/github.com/agiledragon/gomonkey/test/apply_method_test.go:14 +0xf4
  testing.tRunner(0x40001e6820, 0x21c498)
    /usr/local/go/src/testing/testing.go:1595 +0xf8
  created by testing.(*T).Run in goroutine 1
    /usr/local/go/src/testing/testing.go:1648 +0x318

205 total assertions

--- FAIL: TestApplyMethod (0.00s)
unexpected fault address 0x265c1263972d9f
fatal error: fault
[signal SIGSEGV: segmentation violation code=0x1 addr=0x265c1263972d9f pc=0x84fd0]

goroutine 49 [running]:
runtime.throw({0x20ab31?, 0xe75a8?})
    /usr/local/go/src/runtime/panic.go:1077 +0x40 fp=0x40000d9180 sp=0x40000d9150 pc=0x4f9b0
runtime.sigpanic()
    /usr/local/go/src/runtime/signal_unix.go:875 +0x198 fp=0x40000d91b0 sp=0x40000d9180 pc=0x669d8
runtime.memmove()
    /usr/local/go/src/runtime/memmove_arm64.s:65 +0x60 fp=0x40000d91c0 sp=0x40000d91c0 pc=0x84fd0
fmt.(*buffer).writeString(0x4000096b60, {0xd7265c1263972d9f?, 0x40000d9248?})
    /usr/local/go/src/fmt/print.go:108 +0x8c fp=0x40000d9210 sp=0x40000d91c0 pc=0xf4b7c
fmt.(*fmt).padString(0x40000d92b8?, {0xd7265c1263972d9f?, 0x40001ed330?})
    /usr/local/go/src/fmt/format.go:110 +0xac fp=0x40000d9240 sp=0x40000d9210 pc=0xf2f7c
fmt.(*fmt).fmtS(0x100000000462c0?, {0xd7265c1263972d9f?, 0xffff9c3915b8?})
    /usr/local/go/src/fmt/format.go:359 +0x34 fp=0x40000d9270 sp=0x40000d9240 pc=0xf3b04
fmt.(*pp).fmtString(0x40000d92e8?, {0xd7265c1263972d9f?, 0x10?}, 0x1db440?)
    /usr/local/go/src/fmt/print.go:494 +0x8c fp=0x40000d92b0 sp=0x40000d9270 pc=0xf607c
fmt.(*pp).printArg(0x4000096b60, {0x1c5b80?, 0x40001ed310}, 0x76)
    /usr/local/go/src/fmt/print.go:741 +0xf8 fp=0x40000d9320 sp=0x40000d92b0 pc=0xf6ed8
fmt.(*pp).doPrintf(0x4000096b60, {0x20a71f, 0x2}, {0x40000d94b0?, 0x1, 0x1})
    /usr/local/go/src/fmt/print.go:1077 +0x244 fp=0x40000d93d0 sp=0x40000d9320 pc=0xf86e4
fmt.Sprintf({0x20a71f, 0x2}, {0x40000d94b0, 0x1, 0x1})
    /usr/local/go/src/fmt/print.go:239 +0x4c fp=0x40000d9430 sp=0x40000d93d0 pc=0xf527c
github.com/smartystreets/assertions.shouldEqual({0x1c5b80, 0x40001ed310}, {0x1c5b80, 0x22b578})
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/smartystreets/assertions/equality.go:43 +0x220 fp=0x40000d9560 sp=0x40000d9430 pc=0x198bc0
github.com/smartystreets/assertions.ShouldEqual({0x1c5b80, 0x40001ed310}, {0x40001ed320?, 0x1, 0xffff9c3915b8?})
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/smartystreets/assertions/equality.go:24 +0x68 fp=0x40000d95a0 sp=0x40000d9560 pc=0x198938
github.com/smartystreets/goconvey/convey.(*context).So(0x4000036c00?, {0x1c5b80?, 0x40001ed310?}, 0x1a729c?, {0x40001ed320?, 0x1c9dc0?, 0x21c701?})
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/smartystreets/goconvey/convey/context.go:173 +0x48 fp=0x40000d95e0 sp=0x40000d95a0 pc=0x1a09d8
github.com/smartystreets/goconvey/convey.So({0x1c5b80, 0x40001ed310}, 0x20a69b?, {0x40001ed320, 0x1, 0x1})
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/smartystreets/goconvey/convey/doc.go:125 +0x50 fp=0x40000d9630 sp=0x40000d95e0 pc=0x1a1c00
github.com/agiledragon/gomonkey/v2/test.TestApplyPrivateMethod.func1.1()
    /go/src/github.com/agiledragon/gomonkey/test/apply_private_method_test.go:21 +0xc4 fp=0x40000d96a0 sp=0x40000d9630 pc=0x1a72d4
github.com/smartystreets/goconvey/convey.parseAction.func1({0x2193ba, 0x35})
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/smartystreets/goconvey/convey/discovery.go:80 +0x24 fp=0x40000d96b0 sp=0x40000d96a0 pc=0x1a1a34
github.com/smartystreets/goconvey/convey.(*context).conveyInner(0x40001e97a0, {0x2193ba?, 0x400024c480?}, 0x40001ed2f0)
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/smartystreets/goconvey/convey/context.go:261 +0x15c fp=0x40000d9740 sp=0x40000d96b0 pc=0x1a0ebc
github.com/smartystreets/goconvey/convey.(*context).Convey.func1()
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/smartystreets/goconvey/convey/context.go:163 +0x30 fp=0x40000d9770 sp=0x40000d9740 pc=0x1a0900
github.com/jtolds/gls.(*ContextManager).SetValues.func1(0x0)
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/context.go:97 +0x330 fp=0x40000d98e0 sp=0x40000d9770 pc=0x199cb0
github.com/jtolds/gls.EnsureGoroutineId(0x40002072f0)
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/gid.go:19 +0xe8 fp=0x40000d9940 sp=0x40000d98e0 pc=0x19a088
github.com/jtolds/gls.(*ContextManager).SetValues(0x400008a500, 0x4000207290, 0x4000095308)
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/context.go:63 +0x150 fp=0x40000d9980 sp=0x40000d9940 pc=0x199930
github.com/smartystreets/goconvey/convey.(*context).Convey(0x40001e9740, {0x4000085a68?, 0x4000085a68?, 0x19d484?})
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/smartystreets/goconvey/convey/context.go:162 +0x3b8 fp=0x40000d9a10 sp=0x40000d9980 pc=0x1a0898
github.com/smartystreets/goconvey/convey.Convey({0x4000085a68, 0x2, 0x2})
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/smartystreets/goconvey/convey/doc.go:77 +0x3c fp=0x40000d9a40 sp=0x40000d9a10 pc=0x1a1b6c
github.com/agiledragon/gomonkey/v2/test.TestApplyPrivateMethod.func1()
    /go/src/github.com/agiledragon/gomonkey/test/apply_private_method_test.go:13 +0x60 fp=0x40000d9a90 sp=0x40000d9a40 pc=0x1a7700
github.com/smartystreets/goconvey/convey.parseAction.func1({0x20fd2d, 0x16})
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/smartystreets/goconvey/convey/discovery.go:80 +0x24 fp=0x40000d9aa0 sp=0x40000d9a90 pc=0x1a1a34
github.com/smartystreets/goconvey/convey.(*context).conveyInner(0x40001e9740, {0x20fd2d?, 0x0?}, 0x40001ed2c0)
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/smartystreets/goconvey/convey/context.go:261 +0x15c fp=0x40000d9b30 sp=0x40000d9aa0 pc=0x1a0ebc
github.com/smartystreets/goconvey/convey.rootConvey.func1()
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/smartystreets/goconvey/convey/context.go:110 +0xcc fp=0x40000d9bb0 sp=0x40000d9b30 pc=0x1a02bc
github.com/jtolds/gls.(*ContextManager).SetValues.func1(0x0)
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/context.go:97 +0x330 fp=0x40000d9d20 sp=0x40000d9bb0 pc=0x199cb0
github.com/jtolds/gls.EnsureGoroutineId.func1()
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/gid.go:24 +0x2c fp=0x40000d9d40 sp=0x40000d9d20 pc=0x19a0ec
github.com/jtolds/gls._m(0x4000085d98?, 0x19a01c?)
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/stack_tags.go:108 +0x28 fp=0x40000d9d60 sp=0x40000d9d40 pc=0x19ac78
github.com/jtolds/gls.github_com_jtolds_gls_markS(0x37f001?, 0x4000085d80?)
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/stack_tags.go:56 +0x1c fp=0x40000d9d80 sp=0x40000d9d60 pc=0x19a71c
github.com/jtolds/gls.addStackTag(0x37f060?, 0x40002071a0?)
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/stack_tags.go:49 +0x20 fp=0x40000d9da0 sp=0x40000d9d80 pc=0x19a6c0
github.com/jtolds/gls.EnsureGoroutineId(0x40002071a0)
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/gid.go:24 +0xc0 fp=0x40000d9e00 sp=0x40000d9da0 pc=0x19a060
github.com/jtolds/gls.(*ContextManager).SetValues(0x400008a500, 0x4000207140, 0x400001cd80)
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/jtolds/gls/context.go:63 +0x150 fp=0x40000d9e40 sp=0x40000d9e00 pc=0x199930
github.com/smartystreets/goconvey/convey.rootConvey({0x4000085f28?, 0x0?, 0x4000085f18?})
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/smartystreets/goconvey/convey/context.go:105 +0x224 fp=0x40000d9ed0 sp=0x40000d9e40 pc=0x1a01b4
github.com/smartystreets/goconvey/convey.Convey({0x4000085f28, 0x3, 0x3})
    /go/src/github.com/agiledragon/gomonkey/vendor/github.com/smartystreets/goconvey/convey/doc.go:75 +0x50 fp=0x40000d9f00 sp=0x40000d9ed0 pc=0x1a1b80
github.com/agiledragon/gomonkey/v2/test.TestApplyPrivateMethod(0x0?)
    /go/src/github.com/agiledragon/gomonkey/test/apply_private_method_test.go:12 +0x74 fp=0x40000d9f60 sp=0x40000d9f00 pc=0x1a6bb4
testing.tRunner(0x40001e7040, 0x21c4b8)
    /usr/local/go/src/testing/testing.go:1595 +0xf8 fp=0x40000d9fb0 sp=0x40000d9f60 pc=0x116f98
testing.(*T).Run.func1()
    /usr/local/go/src/testing/testing.go:1648 +0x2c fp=0x40000d9fd0 sp=0x40000d9fb0 pc=0x117c4c
runtime.goexit()
    /usr/local/go/src/runtime/asm_arm64.s:1197 +0x4 fp=0x40000d9fd0 sp=0x40000d9fd0 pc=0x846d4
created by testing.(*T).Run in goroutine 1
    /usr/local/go/src/testing/testing.go:1648 +0x318

goroutine 1 [chan receive]:
runtime.gopark(0x21c8b0, 0x40000186e8, 0xe, 0x17, 0x2)
    /usr/local/go/src/runtime/proc.go:398 +0xe0 fp=0x4000086a90 sp=0x4000086a60 pc=0x523b0
runtime.chanrecv(0x4000018690, 0x4000086b8f, 0x1)
    /usr/local/go/src/runtime/chan.go:583 +0x27c fp=0x4000086b10 sp=0x4000086a90 pc=0x1ae1c
runtime.chanrecv1(0x207300?, 0x1c5b80?)
    /usr/local/go/src/runtime/chan.go:442 +0x14 fp=0x4000086b40 sp=0x4000086b10 pc=0x1ab64
testing.(*T).Run(0x40000a0680, {0x20fd2d, 0x16}, 0x21c4b8)
    /usr/local/go/src/testing/testing.go:1649 +0x32c fp=0x4000086c00 sp=0x4000086b40 pc=0x117b1c
testing.runTests.func1(0x4000086c78?)
    /usr/local/go/src/testing/testing.go:2054 +0x48 fp=0x4000086c50 sp=0x4000086c00 pc=0x119748
testing.tRunner(0x40000a0680, 0x4000086d48)
    /usr/local/go/src/testing/testing.go:1595 +0xf8 fp=0x4000086ca0 sp=0x4000086c50 pc=0x116f98
testing.runTests(0x40000980a0?, {0x37a440, 0xe, 0xe}, {0x20d5f8?, 0xf?, 0x37f140?})
    /usr/local/go/src/testing/testing.go:2052 +0x2ec fp=0x4000086d70 sp=0x4000086ca0 pc=0x11964c
testing.(*M).Run(0x40000980a0)
    /usr/local/go/src/testing/testing.go:1925 +0x418 fp=0x4000086ed0 sp=0x4000086d70 pc=0x1184f8
main.main()
    _testmain.go:73 +0x90 fp=0x4000086f50 sp=0x4000086ed0 pc=0x1abd70
runtime.main()
    /usr/local/go/src/runtime/proc.go:267 +0x244 fp=0x4000086fd0 sp=0x4000086f50 pc=0x51f54
runtime.goexit()
    /usr/local/go/src/runtime/asm_arm64.s:1197 +0x4 fp=0x4000086fd0 sp=0x4000086fd0 pc=0x846d4

goroutine 2 [force gc (idle)]:
runtime.gopark(0x21cbe0, 0x37eaf0, 0x11, 0x14, 0x1)
    /usr/local/go/src/runtime/proc.go:398 +0xe0 fp=0x4000030f70 sp=0x4000030f40 pc=0x523b0
runtime.goparkunlock(0x0?, 0x0?, 0x0?, 0x0?)
    /usr/local/go/src/runtime/proc.go:404 +0x34 fp=0x4000030fa0 sp=0x4000030f70 pc=0x52444
runtime.forcegchelper()
    /usr/local/go/src/runtime/proc.go:322 +0xb4 fp=0x4000030fd0 sp=0x4000030fa0 pc=0x521d4
runtime.goexit()
    /usr/local/go/src/runtime/asm_arm64.s:1197 +0x4 fp=0x4000030fd0 sp=0x4000030fd0 pc=0x846d4
created by runtime.init.6 in goroutine 1
    /usr/local/go/src/runtime/proc.go:310 +0x24

goroutine 3 [GC sweep wait]:
runtime.gopark(0x21cbe0, 0x37eee0, 0xc, 0x14, 0x1)
    /usr/local/go/src/runtime/proc.go:398 +0xe0 fp=0x4000031730 sp=0x4000031700 pc=0x523b0
runtime.goparkunlock(0x1?, 0x0?, 0x0?, 0x0?)
    /usr/local/go/src/runtime/proc.go:404 +0x34 fp=0x4000031760 sp=0x4000031730 pc=0x52444
runtime.bgsweep(0x0?)
    /usr/local/go/src/runtime/mgcsweep.go:321 +0xdc fp=0x40000317b0 sp=0x4000031760 pc=0x3b2bc
runtime.gcenable.func1()
    /usr/local/go/src/runtime/mgc.go:200 +0x28 fp=0x40000317d0 sp=0x40000317b0 pc=0x300d8
runtime.goexit()
    /usr/local/go/src/runtime/asm_arm64.s:1197 +0x4 fp=0x40000317d0 sp=0x40000317d0 pc=0x846d4
created by runtime.gcenable in goroutine 1
    /usr/local/go/src/runtime/mgc.go:200 +0x6c

goroutine 4 [GC scavenge wait]:
runtime.gopark(0x21cbe0, 0x37f240, 0xd, 0x14, 0x2)
    /usr/local/go/src/runtime/proc.go:398 +0xe0 fp=0x4000031f20 sp=0x4000031ef0 pc=0x523b0
runtime.goparkunlock(0x4000018070?, 0xb8?, 0x9b?, 0x0?)
    /usr/local/go/src/runtime/proc.go:404 +0x34 fp=0x4000031f50 sp=0x4000031f20 pc=0x52444
runtime.(*scavengerState).park(0x37f240)
    /usr/local/go/src/runtime/mgcscavenge.go:425 +0x4c fp=0x4000031f80 sp=0x4000031f50 pc=0x3875c
runtime.bgscavenge(0x0?)
    /usr/local/go/src/runtime/mgcscavenge.go:658 +0x60 fp=0x4000031fb0 sp=0x4000031f80 pc=0x38ca0
runtime.gcenable.func2()
    /usr/local/go/src/runtime/mgc.go:201 +0x28 fp=0x4000031fd0 sp=0x4000031fb0 pc=0x30078
runtime.goexit()
    /usr/local/go/src/runtime/asm_arm64.s:1197 +0x4 fp=0x4000031fd0 sp=0x4000031fd0 pc=0x846d4
created by runtime.gcenable in goroutine 1
    /usr/local/go/src/runtime/mgc.go:201 +0xac

goroutine 17 [finalizer wait]:
runtime.gopark(0x21c910, 0x3b30f8, 0x10, 0x14, 0x1)
    /usr/local/go/src/runtime/proc.go:398 +0xe0 fp=0x4000030580 sp=0x4000030550 pc=0x523b0
runtime.runfinq()
    /usr/local/go/src/runtime/mfinal.go:193 +0xf0 fp=0x40000307d0 sp=0x4000030580 pc=0x2f2c0
runtime.goexit()
    /usr/local/go/src/runtime/asm_arm64.s:1197 +0x4 fp=0x40000307d0 sp=0x40000307d0 pc=0x846d4
created by runtime.createfing in goroutine 1
    /usr/local/go/src/runtime/mfinal.go:163 +0x4c

goroutine 20 [GC worker (idle)]:
runtime.gopark(0x21c938, 0x40000e6020, 0x1a, 0x14, 0x0)
    /usr/local/go/src/runtime/proc.go:398 +0xe0 fp=0x400002c720 sp=0x400002c6f0 pc=0x523b0
runtime.gcBgMarkWorker()
    /usr/local/go/src/runtime/mgc.go:1293 +0xd8 fp=0x400002c7d0 sp=0x400002c720 pc=0x31848
runtime.goexit()
    /usr/local/go/src/runtime/asm_arm64.s:1197 +0x4 fp=0x400002c7d0 sp=0x400002c7d0 pc=0x846d4
created by runtime.gcBgMarkStartWorkers in goroutine 19
    /usr/local/go/src/runtime/mgc.go:1217 +0x28

goroutine 33 [GC worker (idle)]:
runtime.gopark(0x21c938, 0x40000e6040, 0x1a, 0x14, 0x0)
    /usr/local/go/src/runtime/proc.go:398 +0xe0 fp=0x4000106720 sp=0x40001066f0 pc=0x523b0
runtime.gcBgMarkWorker()
    /usr/local/go/src/runtime/mgc.go:1293 +0xd8 fp=0x40001067d0 sp=0x4000106720 pc=0x31848
runtime.goexit()
    /usr/local/go/src/runtime/asm_arm64.s:1197 +0x4 fp=0x40001067d0 sp=0x40001067d0 pc=0x846d4
created by runtime.gcBgMarkStartWorkers in goroutine 19
    /usr/local/go/src/runtime/mgc.go:1217 +0x28

goroutine 21 [GC worker (idle)]:
runtime.gopark(0x21c938, 0x40000e6060, 0x1a, 0x14, 0x0)
    /usr/local/go/src/runtime/proc.go:398 +0xe0 fp=0x400002cf20 sp=0x400002cef0 pc=0x523b0
runtime.gcBgMarkWorker()
    /usr/local/go/src/runtime/mgc.go:1293 +0xd8 fp=0x400002cfd0 sp=0x400002cf20 pc=0x31848
runtime.goexit()
    /usr/local/go/src/runtime/asm_arm64.s:1197 +0x4 fp=0x400002cfd0 sp=0x400002cfd0 pc=0x846d4
created by runtime.gcBgMarkStartWorkers in goroutine 19
    /usr/local/go/src/runtime/mgc.go:1217 +0x28

goroutine 22 [GC worker (idle)]:
runtime.gopark(0x21c938, 0x40000e6080, 0x1a, 0x14, 0x0)
    /usr/local/go/src/runtime/proc.go:398 +0xe0 fp=0x400002d720 sp=0x400002d6f0 pc=0x523b0
runtime.gcBgMarkWorker()
    /usr/local/go/src/runtime/mgc.go:1293 +0xd8 fp=0x400002d7d0 sp=0x400002d720 pc=0x31848
runtime.goexit()
    /usr/local/go/src/runtime/asm_arm64.s:1197 +0x4 fp=0x400002d7d0 sp=0x400002d7d0 pc=0x846d4
created by runtime.gcBgMarkStartWorkers in goroutine 19
    /usr/local/go/src/runtime/mgc.go:1217 +0x28
exit status 2
FAIL    github.com/agiledragon/gomonkey/v2/test 0.015s
agiledragon commented 10 months ago

@myzhan Let's take a look!

myzhan commented 10 months ago

@myzhan Let's take a look!

OK, I can try to reproduce it in a container.

myzhan commented 10 months ago

Now I reproduce errors on M1 without container, with a larger testsuite.

agiledragon commented 10 months ago

Oh, for the version v2.11.0, the permission denied problem on MacOS is still not completely solved.

myzhan commented 10 months ago

有点奇怪,在 M1 上,我为了缩小问题范围,构造了一个目前 master 分支跑会报错的最小用例。

package test

import (
  "errors"
  "testing"

  . "github.com/agiledragon/gomonkey/v2"
  "github.com/agiledragon/gomonkey/v2/test/fake"

  . "github.com/smartystreets/goconvey/convey"
)

func TestApplyMethod(t *testing.T) {
  slice := fake.NewSlice()
  var s *fake.Slice
  Convey("TestApplyMethod", t, func() {

    Convey("use gomonkey", func() {
      patches := ApplyMethod(s, "Add", func(_ *fake.Slice, _ int) error {
        return errors.New("mock err")
      })
      defer patches.Reset()
      err := slice.Add(1)
      So(err, ShouldNotBeNil)
    })

  })
}

上面的用例运行会报错。但是我加上 mockey 的用例后,两个用例都成功了。在 mockey 代码还未开始跑的时候,gomonkey 的用例也成功了。

package test

import (
  "errors"
  "testing"

  . "github.com/agiledragon/gomonkey/v2"
  "github.com/agiledragon/gomonkey/v2/test/fake"

  . "github.com/bytedance/mockey"
  . "github.com/smartystreets/goconvey/convey"
)

func TestApplyMethod(t *testing.T) {
  slice := fake.NewSlice()
  var s *fake.Slice
  Convey("TestApplyMethod", t, func() {

    Convey("use gomonkey", func() {
      patches := ApplyMethod(s, "Add", func(_ *fake.Slice, _ int) error {
        return errors.New("mock err")
      })
      defer patches.Reset()
      err := slice.Add(1)
      So(err, ShouldNotBeNil)
    })
    PatchConvey("use mockey", func() {
      Mock((*fake.Slice).Add).Return(errors.New("mock err2")).Build()
      err := s.Add(1)
      So(err, ShouldNotBeNil)
    })
  })
}

本来加上 mockey,是为了对比两者修改的函数地址是否一致,替换的机器码是否类似。没想到引入 mockey 后,gomonkey 的错误不能复现了。。