19

golang proto 生成 Mac M1安装protoc-gen-go

 2 years ago
source link: https://studygolang.com/articles/35388
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

golang proto 生成 Mac M1安装protoc-gen-go

eflight · 3天之前 · 97 次点击 · 预计阅读时间不到 1 分钟 · 大约8小时之前 开始浏览    

电脑配置:Mac M1

go get -u github.com/akkagao/go2proto

go get -u github.com/golang/protobuf/protoc-gen-go

执行以上两条go get,都会报错

go get: cannot install cross-compiled binaries when GOBIN is set

原因: 查看vim ~/.zshrc,环境配置文件,发现自己配置设置为:

export GOARCH=amd64

我安装的go是arm版本的,这里为了方便编译其他程序,写了这句话,改为

export GOARCH=arm64

保存退出执行source ~/.zshrc,就可以执行成功上面两条 go get 了


有疑问加站长微信联系(非本文作者))

280

入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:701969077

添加一条新回复 (您需要 登录 后才能回复 没有账号 ?)
  • 请尽量让自己的回复能够对别人有帮助
  • 支持 Markdown 格式, **粗体**、~~删除线~~、`单行代码`
  • 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
  • 图片支持拖拽、截图粘贴等方式上传

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK