agiledragon / gomonkey

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

panic: permission denied [recovered] macOS 12 apple m1 pro #77

Open hao1032 opened 2 years ago

hao1032 commented 2 years ago
image

` === RUN Test_Trigger --- FAIL: Test_Trigger (0.34s) panic: permission denied [recovered] panic: permission denied

goroutine 117 [running]: testing.tRunner.func1.2(0x101d08920, 0x102a6bc88) /Users/tango/sdk/go1.16.13/src/testing/testing.go:1143 +0x25c testing.tRunner.func1(0x1400060e480) /Users/tango/sdk/go1.16.13/src/testing/testing.go:1146 +0x384 panic(0x101d08920, 0x102a6bc88) /Users/tango/sdk/go1.16.13/src/runtime/panic.go:965 +0x14c github.com/agiledragon/gomonkey/v2.modifyBinary(0x10155ca90, 0x14000f22198, 0x18, 0x18) /Users/tango/go/pkg/mod/github.com/agiledragon/gomonkey/v2@v2.4.0/modify_binary_darwin.go:9 +0xec github.com/agiledragon/gomonkey/v2.replace(0x10155ca90, 0x14001e79960, 0x14001f58ed0, 0x14001f59a90, 0x101be0500) /Users/tango/go/pkg/mod/github.com/agiledragon/gomonkey/v2@v2.4.0/patch.go:196 +0xb8 github.com/agiledragon/gomonkey/v2.(Patches).ApplyCore(0x14001f59008, 0x101be05a0, 0x101f0e150, 0x13, 0x101be05a0, 0x14001e79960, 0x13, 0x1016cd448) /Users/tango/go/pkg/mod/github.com/agiledragon/gomonkey/v2@v2.4.0/patch.go:158 +0x104 github.com/agiledragon/gomonkey/v2.(Patches).ApplyFunc(0x14001f59008, 0x101be05a0, 0x101f0e150, 0x101be05a0, 0x14001e79960, 0x4) /Users/tango/go/pkg/mod/github.com/agiledragon/gomonkey/v2@v2.4.0/patch.go:66 +0x138 github.com/agiledragon/gomonkey/v2.ApplyFunc(...) /Users/tango/go/pkg/mod/github.com/agiledragon/gomonkey/v2@v2.4.0/patch.go:24 git.code.oa.com/fabriceli/drules/service/cmd/ruleshub.initMock(0x14000024eb8, 0x10089b3a4) /Users/tango/Code/GolandProjects/drules/service/cmd/ruleshub/main_test.go:62 +0x224 /Users/tango/Code/GolandProjects/drules/service/cmd/ruleshub/main_test.go:35 +0x9c testing.tRunner(0x1400060e480, 0x101f0e100) /Users/tango/sdk/go1.16.13/src/testing/testing.go:1193 +0xd8 created by testing.(*T).Run /Users/tango/sdk/go1.16.13/src/testing/testing.go:1238 +0x21c

Process finished with the exit code 1 `

super-eggs commented 2 years ago

export GOARCH=amd64

liuzhaoce commented 2 years ago

请问现在是怎么解决这个问题的呀,GOARCH设置为amd64对debug有影响

hao1032 commented 2 years ago

export GOARCH=amd64

这样就没法debug了

super-eggs commented 2 years ago

export GOARCH=amd64

这样就没法debug了

确实,目前还没有找到更好的办法。

blanche789 commented 2 years ago

有找到解决的办法吗?目前除了改GOARCH=amd64还有更好的办法吗?这样不能debug @agiledragon

agiledragon commented 2 years ago

Please try to this method, https://github.com/agiledragon/gomonkey/issues/70 @blanche789

zhijian-pro commented 2 years ago

go 1.17.8 #70 方法不行

agiledragon commented 2 years ago

Please try to this method: #70 arm64 MacOS can use amd64 version go, I change to go1.16.11 darwin/amd64,and https://github.com/eisenxp/macos-golink-wrapper

89trillion-zhaoyang commented 2 years ago

I have the same issue,how can I solve it?

LaurenceLiZhixin commented 2 years ago

I have the same issue too.

WangsYi commented 2 years ago

I have the same issue too, and export GOARCH=amd64 can resolve temporary.

dino-ma commented 2 years ago
image

I have the same issue too, and export GOARCH=amd64 can't resolve temporary.

jiangshuai1995 commented 2 years ago

+1

lone1y-51 commented 2 years ago

I have the same issue too.

qiu-peng20 commented 2 years ago

我也遇到了

linchupeng commented 2 years ago

现在最新版本有兼容这个问题了吗? 我这边测试还是会报这个错误。

liuzhenchuan commented 2 years ago

升级到v2.9.0还是出现同样的问题, export GOARCH=amd64 也不起作用,什么时候能修复这个问题

linchupeng commented 2 years ago

这是来自QQ邮箱的假期自动回复邮件。您好,我最近正在休假中,无法亲自回复您的邮件。我将在假期结束后,尽快给您回复。

agiledragon commented 2 years ago

This is a limitation of the Apple M1 chip, which does not allow dynamic modification of the content of the code area.

cyniubi commented 2 years ago

This is a limitation of the Apple M1 chip, which does not allow dynamic modification of the content of the code area.M1 请问下M1笔记本上有办法可以使用吗?

LargeOrange commented 11 months ago

+1,我也遇见了这个问题

linchupeng commented 11 months ago

这是来自QQ邮箱的假期自动回复邮件。您好,我最近正在休假中,无法亲自回复您的邮件。我将在假期结束后,尽快给您回复。

agiledragon commented 10 months ago

v2.11.0 has been released!