【发布时间】:2019-12-08 10:05:02
【问题描述】:
我一直在关注 gRPC 教程,这非常好。当我尝试将https://github.com/grpc-ecosystem/grpc-gateway 添加到我的项目时,问题就开始了。我使用他们给你的命令:
go get -u github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway
go get -u github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger
go get -u github.com/golang/protobuf/protoc-gen-go
然后我在我的原型中导入包:
import "google/api/annotations.proto";
我在上面的行中收到“找不到文件”的错误。 当我在我的项目中复制文件时,它们被发现但是当我运行命令时
protoc -I/usr/local/include -I. \
-I$GOPATH/src \
-I$GOPATH/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis \
--go_out=plugins=grpc:. \
path/to/your_service.proto
它会抱怨找不到文件。
有人可以告诉我如何让这个 grpc-gateway 正常工作的正确方法吗?
我目前在使用 GoLand 作为 IDE 的 Windows 上。
【问题讨论】: