go get -u google.golang.org/grpc
go get -u google.golang.org/protobuf/cmd/protoc-gen-go
go get -u google.golang.org/grpc/cmd/protoc-gen-go-grpc
go get -u github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway
go install github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway
go install github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2
go install google.golang.org/protobuf/cmd/protoc-gen-go
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc
import (
_ "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway"
_ "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2"
_ "google.golang.org/grpc/cmd/protoc-gen-go-grpc"
_ "google.golang.org/protobuf/cmd/protoc-gen-go"
)
//万能命令
protoc -I ./getMessageIdProtoFlie(proto文件所在目录) --go_out=./getMessageIGrpcGateway(编译后文件目录) --go-grpc_out=./getMessageIGrpcGateway(编译后文件目录) --grpc-gateway_out=logtostderr=true:./getMessageIGrpcGateway(编译后文件目录) getMessageId.proto
protoc -I ./getMessageIdProtoFlie --go_out=./getMessageIGrpcGateway --go-grpc_out=./getMessageIGrpcGateway --grpc-gateway_out=logtostderr=true:./getMessageIGrpcGateway getMessageId.proto
grpc-Getway 一行全能编译命令 || golang grpc最新版无法生成功Server接口(interface)
于 2022-06-19 12:51:52 首次发布