我一直在遵循一个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然后我将包导入到我的proto中:
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网关正常工作吗?
我目前在windows上使用GoLand作为集成开发环境。
发布于 2019-12-09 02:40:58
如果我没看错的话,它和你的是一样的。他们说您必须将这些文件放入存储库https://github.com/grpc-ecosystem/grpc-gateway/issues/1065#issuecomment-544241612中
https://stackoverflow.com/questions/59234313
复制相似问题