美文网首页
MacBook Air M1 运行 go test

MacBook Air M1 运行 go test

作者: ytxing | 来源:发表于2021-01-15 11:00 被阅读0次

我在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=.

即可正常。

相关文章

网友评论

      本文标题:MacBook Air M1 运行 go test

      本文链接:https://www.haomeiwen.com/subject/bliiaktx.html