go-zero 开发之安装 goctl 及 go-zero 开发依赖

发布时间 2023-12-06 22:45:17作者: -见

安装 goctl

go 版本在 1.16 及以后执行:

GO111MODULE=on&&go install github.com/zeromicro/go-zero/tools/goctl@latest

go 版本在 1.16 之前执行:

GO111MODULE=on&&go get -u github.com/zeromicro/go-zero/tools/goctl@latest

验证是否安装成功:

# goctl --version
goctl version 1.6.0 linux/amd64
  • 安装参考
https://go-zero.dev/docs/tasks/installation/goctl

一键安装 protoc、protoc-gen-go 和 protoc-gen-go-grpc 相关组件

# goctl env check --install --verbose --force
[goctl-env]: preparing to check env

[goctl-env]: looking up "protoc"
[goctl-env]: "protoc" is installed

[goctl-env]: looking up "protoc-gen-go"
[goctl-env]: "protoc-gen-go" is installed

[goctl-env]: looking up "protoc-gen-go-grpc"
[goctl-env]: "protoc-gen-go-grpc" is installed

[goctl-env]: congratulations! your goctl environment is ready!

验证是否安装成功:

# goctl env check --verbose
[goctl-env]: preparing to check env

[goctl-env]: looking up "protoc"
[goctl-env]: "protoc" is installed

[goctl-env]: looking up "protoc-gen-go"
[goctl-env]: "protoc-gen-go" is installed

[goctl-env]: looking up "protoc-gen-go-grpc"
[goctl-env]: "protoc-gen-go-grpc" is installed

[goctl-env]: congratulations! your goctl environment is ready!
  • 安装参考
https://go-zero.dev/docs/tasks/installation/protoc