-
Notifications
You must be signed in to change notification settings - Fork 180
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
macos m2 兼容性问题 #150
Comments
Can you post the complete program? |
package main
func main() {
_, _, _ = Execute()
}
func Execute() (int, int, int) {
s := S{}
return F1(), F2(), s.F3()
}
func F1() int {
return 1
}
func F2() int {
return 2
}
type S struct {
}
func (*S) F3() int {
return 3
}
package main_test
import (
"github.com/agiledragon/gomonkey/v2"
"github.com/go-playground/assert/v2"
"gomonkey_arm64"
"testing"
)
func TestExecute(t *testing.T) {
rst1Expect := 11
gomonkey.
ApplyFunc(main.F1, func() int {
return rst1Expect
})
rst1, _, _ := main.Execute()
assert.Equal(t, rst1Expect, rst1)
}
package main_test
import (
"github.com/agiledragon/gomonkey/v2"
"github.com/go-playground/assert/v2"
"gomonkey_arm64"
"reflect"
"testing"
)
func TestExecute(t *testing.T) {
s := main.S{}
rst1Expect := 11
rst2Expect := 12
rst3Expect := 13
gomonkey.
ApplyFunc(main.F1, func() int {
return rst1Expect
}).
ApplyFunc(main.F2, func() int {
return rst2Expect
}).
ApplyMethod(reflect.TypeOf(&s), "F3", func(_ *main.S) int {
return rst3Expect
})
rst1, rst2, rst3 := main.Execute()
assert.Equal(t, rst1Expect, rst1)
assert.Equal(t, rst2Expect, rst2)
assert.Equal(t, rst3Expect, rst3)
}
|
same problem |
same problem vv2.11.0, processor: m3pro |
+1 |
@wustrong @shubham-dogra-pingsafe 已经有项目用xgo验证可以兼容M2,M3,参考: kilianc/base-golang#3 xgo使用:https://github.com/xhd2015/xgo . |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
v2.11.0 版本可以使用打桩,权限报错消失了,但在一个测试方法中,进行多个成员方法打桩,除第一个,其他的打桩不生效,测试后Intel 的 mac 没有问题,M 系统的 mac 会 有这个问题。
代码 demo:
MethodB不会生效
The text was updated successfully, but these errors were encountered: