Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please help: google/api/annotations.proto: File not found. #283

Closed
pzsfeng opened this issue Dec 20, 2016 · 5 comments
Closed

Please help: google/api/annotations.proto: File not found. #283

pzsfeng opened this issue Dec 20, 2016 · 5 comments

Comments

@pzsfeng
Copy link

pzsfeng commented Dec 20, 2016

Hi,

I am a grpc newbie, like gprc and am looking forward to auto-generate REST API from my .proto files.

I am probably making some mistake in my setup. Could you please take a look and help? Am I missing a package? Am I invoking the protoc with incorrect params?

My setup details are below.

I am unable to compile the .proto file with the annotation.

Building proto files...
google/api/annotations.proto: File not found.
serverrpc.proto: Import "google/api/annotations.proto" was not found or had errors.

-- My script

export SCRIPTDIR=/libera
export GOPATH=$SCRIPTDIR
echo "Building proto files..."
export PATH=$PATH:$SCRIPTDIR/bin
cd $SCRIPTDIR/bin
protoc -I$SCRIPTDIR/src/server/rpcdef/
-I$SCRIPTDIR/src/vendor/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis \
--go_out=$SCRIPTDIR/src/server/rpcdef $SCRIPTDIR/src/server/rpcdef/serverrpc.proto

-- Directory layout

[root@63f0407abe77 libera]# pwd
/libera
[root@63f0407abe77 libera]# ls bin/
gvt protoc protoc-gen-go protoc_bk server.log
[root@63f0407abe77 libera]#
[root@63f0407abe77 libera]# ls src/server/rpcdef/
serverrpc.pb.go serverrpc.proto

The vendor dir below has all the packages required:

[root@63f0407abe77 src]# pwd
/libera/src
[root@63f0407abe77 src]# ls vendor/
cloud.google.com github.com go4.org golang.org google.golang.org gopkg.in manifest

-- serverrpc.proto file

1 syntax = "proto3";
2
3 package serversvc;
4
5 import "google/api/annotations.proto";
6
7 // The greeting service definition.
8 service ServerSvc {
9 // Sends a greeting
10 rpc GetStatus (ServerSvcStatusRequest) returns (ServerSvcStatusResponse) {
11 option (google.api.http) = {
12 post: "/v1/getstatus"
13 body: "*"
14 };
15 }

[root@63f0407abe77 bin]# ./protoc --version
libprotoc 3.1.0

@pzsfeng pzsfeng changed the title Blocker error: google/api/annotations.proto: File not found. Please help: google/api/annotations.proto: File not found. Dec 20, 2016
@fiibbb
Copy link

fiibbb commented Dec 20, 2016

@pzsfeng I think you are missing the import part in your protoc command

--go_out=Mgoogle/api/annotations.proto=github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis/google/api,plugins=grpc:.

I believe this ^ maps github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis to google/api/annotations.proto

This is from the README

@pzsfeng
Copy link
Author

pzsfeng commented Dec 21, 2016

@fiibbb Thanks for taking a look.

I think you are missing the import part in your protoc command

I didn't quite understand it. Could you please mention how to invoke it? Thanks.

@achew22
Copy link
Collaborator

achew22 commented Jan 4, 2017

Just doing a little bit of tidying. I hope that your question was answered in a way that let your project continue. If you have any more questions feel free to reopen this issue.

@achew22 achew22 closed this as completed Jan 4, 2017
@tamalsaha tamalsaha mentioned this issue Mar 30, 2017
1 task
@cappuccino5
Copy link

楼主这个解决了吗?我是新手,也遇到这样的问题
image

@johanbrandhorst
Copy link
Collaborator

Hi @cappucino5. Please reach out for help with this type of matter on chat services such as Gophers slack channel. This is not the best medium for this kind of debugging.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants