go get -u github.com/golang/protobuf/proto
go install github.com/golang/protobuf/protoc-gen-go@latest
go install github.com/gogo/protobuf/protoc-gen-gogo@latest go install github.com/gogo/protobuf/protoc-gen-gofast@latest //依赖 go get github.com/gogo/protobuf/proto go get github.com/gogo/protobuf/gogoproto
// grpc (或者git clone https://github.com/grpc/grpc-go 然后复制到google.golang.org/grpc)go get -u google.golang.org/grpc
// genproto (或者git clone https://github.com/google/go-genproto 然后复制到google.golang.org/genproto)go get google.golang.org/genproto/...
go install github.com/go-kratos/kratos/tool/kratos@latest
kratos new kratos-demo
cd kratos-demo kratos run
安装
##### go install 安装:
```
go install github.com/go-kratos/kratos/cmd/kratos/v2@latest
kratos upgrade
```
##### 源码编译安装:
```
git clone https://github.com/go-kratos/kratos
cd kratos
make install
```
### Create a service
```
# 创建项目模板
kratos new helloworld
cd helloworld
# 拉取项目依赖
go mod download
# 生成proto模板
kratos proto add api/helloworld/helloworld.proto
# 生成proto源码
kratos proto client api/helloworld/helloworld.proto
# 生成server模板
kratos proto server api/helloworld/helloworld.proto -t internal/service
# 生成所有proto源码、wire等等
go generate ./... (需要安装依赖 go install github.com/google/wire/cmd/wire@v0.5.0)
# 编译成可执行文件
go build -o ./bin/ ./...
# 运行程序
kratos run
或
./bin/demo -conf ./configs # demo为所创建项目名称
```