MacBook Air M1 运行 go test

2021-01-15  本文已影响0人  ytxing

我在M1版本的MacBook Air上运行go test,会遇到错误。

一般会输出类似如下的错误提示:

gcc_arm64.S:63:16: error: brackets expression not supported on this target
 ldp x23, x24, [sp, #48]
               ^
gcc_arm64.S:66:16: error: brackets expression not supported on this target
 ldp x21, x22, [sp, #64]
               ^
gcc_arm64.S:69:16: error: brackets expression not supported on this target
 ldp x19, x20, [sp, #80]
               ^

这个需要禁用CGO,比如

CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go test -bench=.

即可正常。

上一篇 下一篇

猜你喜欢

热点阅读