Indicate the compiler protobuf the way to googleapis
-
As to the compiler protobuf on the way to google/api/annotations.proto or how to correctly establish https://github.com/googleapis/googleapis/tree/master/google/api ? This code:
import "google/api/annotations.proto";
Makes the following mistake:
Import "google/api/annotations.proto" was not found or had errors
Compiling by team:
protoc -I $MYPATH/github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options -I . --grpc-gateway_out . \ --grpc-gateway_opt logtostderr=true \ --grpc-gateway_opt paths=source_relative \ service.proto
-
You need to. https://github.com/googleapis/googleapis or by team:
go install github.com/googleapis/googleapis@latest
or by:
git clone https://github.com/googleapis/googleapis
It is further necessary to indicate the way to the downloaded project. For example, I was downloading with help.
git clone
the same directory where my service is.proto.protoc -I googleapis/ -I . --grpc-gateway_out . \ --grpc-gateway_opt logtostderr=true \ --grpc-gateway_opt paths=source_relative \ service.proto
Same thing if you loaded with go get:
protoc -I $GOPATH/pkg/mod/github.com/googleapis/googleapis@<version>/ -I . --grpc-gateway_out . \ --grpc-gateway_opt logtostderr=true \ --grpc-gateway_opt paths=source_relative \ service.proto
I assume you're trying to turn reverse proxy. Maybe you can help. https://github.com/grpc-ecosystem/grpc-gateway#usage