agiledragon / gomonkey

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

Method:buildJmpDirective报未定义 #87

Open rockingl opened 2 years ago

rockingl commented 2 years ago

电脑os:mac m1 go版本:go1.17.9 goland版本:2021.3.4 apple silicon

go env如下: GO111MODULE="on" GOARCH="arm64" GOBIN="" GOCACHE="/Users/xxx/Library/Caches/go-build" GOENV="/Users/xxx/Library/Application Support/go/env" GOEXE="" GOEXPERIMENT="" GOFLAGS="" GOHOSTARCH="arm64" GOHOSTOS="darwin" GOINSECURE="" GOMODCACHE="/Users/xxx/go/pkg/mod" GONOPROXY="" GONOSUMDB="" GOOS="darwin" GOPATH="/Users/xxx/go" GOPRIVATE="" GOPROXY="https://goproxy.cn,direct" GOROOT="/usr/local/go" GOSUMDB="sum.golang.org" GOTMPDIR="" GOTOOLDIR="/usr/local/go/pkg/tool/darwin_arm64" GOVCS="" GOVERSION="go1.17.9" GCCGO="gccgo" AR="ar" CC="clang" CXX="clang++" CGO_ENABLED="1" GOMOD="/Users/xxx/go/src/cloudup-agentserver/go.mod" CGO_CFLAGS="-g -O2" CGO_CPPFLAGS="" CGO_CXXFLAGS="-g -O2" CGO_FFLAGS="-g -O2" CGO_LDFLAGS="-g -O2" PKG_CONFIG="pkg-config" GOGCCFLAGS="-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/z9/15qdh_jj0b15k78q220l6g800000gn/T/go-build292941388=/tmp/go-build -gno-record-gcc-switches -fno-common"

报错如下:

image image

求大神帮我解决,感觉是m1 兼容性的问题

leo-bin commented 2 years ago

估计是你拉的gomonkey版本太低了,好像是v2.2.0才支持的arm架构~

rockingl commented 2 years ago

升级到 v2.7.0版本了 还是不行

rockingl commented 2 years ago

哭了 谁来帮帮我

rockingl commented 2 years ago

换成amd 版本 golang 虽然好了 但是不能debug 太egg ache了

xhd2015 commented 1 year ago

换成amd 版本 golang 虽然好了 但是不能debug 太egg ache了

Hi guy we have made another replacement for mocking functions at here: https://github.com/xhd2015/go-mock, can that help you?

hxy1991 commented 1 year ago
image

GOARCH=amd64