gogo.proto: File not found

4,057 views
Skip to first unread message

hamish...@gmail.com

unread,
Jan 12, 2015, 7:20:19 AM1/12/15
to gogopr...@googlegroups.com
I have protoc working, but when i try to use gogoproto i get an issue that doesn't really help me work out what is going on.

I'm executing the following command in a dir that has a single proto file, which previously compiled fine until i added the gogoproto import in.

protoc --gogo_out=. *.proto

The error output:
/path-to/go/src/github.com/gogo/protobuf/gogoproto/gogo.proto: File not found.
term.proto: Import "/path-to/go/src/github.com/gogo/protobuf/gogoproto/gogo.proto" was not found or had errors.

Notes:
1. That file definitely exists, i can use the exact path displayed in the error message to get to it. Permissions are fine.
2. I thought it might be something silly i was doing, so i used the example proto schema file instead of mine and the same thing happens.
3. I saw in the install instructions you may need to use the following, but this didn't help either:
protoc --gogo_out=. -I=.:github.com/gogo/protobuf/protobuf *.proto

I'm on OSX Yosemite, the protoc version is 2.6.0. Any ideas? Thanks in advance.

Walter Schulze

unread,
Jan 12, 2015, 7:48:50 AM1/12/15
to hamish...@gmail.com, gogopr...@googlegroups.com
Please see the example

You need to include a proto_path which points to all your dependancies.
This includes your file, gogoproto.proto (your file depends on this) and descriptor.proto (gogoproto.proto depends on this).

I hope this helps.


--
You received this message because you are subscribed to the Google Groups "gogoprotobuf" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gogoprotobuf...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Hamish Ogilvy

unread,
Jan 12, 2015, 6:07:41 PM1/12/15
to Walter Schulze, gogopr...@googlegroups.com
Thanks for the quick response Walter. Ok cool, I didn't see the Makefile in the install instructions, but I did play with the proto_path, without success. 

Anyhow, I just tried the Makefile, but i'm still getting the same issue. I added the current directory, the path to "gogo.proto" (i don't have a "gogoproto.proto" nor see one in the repo?) and the path to "descriptor.proto", but i get the same error.

Makefile looks like:
regenerate:

Many thanks again for your help.

Hamish

Hamish Ogilvy

unread,
Jan 12, 2015, 9:31:57 PM1/12/15
to Walter Schulze, gogopr...@googlegroups.com
ok worked it out. The dependencies call other dependencies in "google/protobuf/", so these need to be in the path correctly also. The errors are pretty misleading. Anyhow, works great, super fast!

Walter Schulze

unread,
Jan 13, 2015, 9:21:28 AM1/13/15
to Hamish Ogilvy, gogopr...@googlegroups.com
I think the path errors are generated by protoc.
Sorry for the inconvenience.
I am very pleased that you worked it out :)

ruia...@gmail.com

unread,
Aug 31, 2015, 3:02:11 AM8/31/15
to gogoprotobuf, hamish...@gmail.com
在 2015年1月12日星期一 UTC+8下午8:48:50,Walter Schulze写道:
hello i met this problem too , but i don't got the answer now . pls help me 。


and my work path is:
[root@SJZ-LQ- message]# pwd
/root/test/message
[root@SJZ-LQ- message]# ls
example.proto Makefile message.proto

but :
protoc - -proto_path=../../../usr/local/gopath/src/github.com/gogo/protobuf/gogoproto:../../../usr/local/gopath/src/github.com/google/protobuf:. --gofast_out=. message.proto
github.com/gogo/protobuf/gogoproto/gogo.proto: File not found.
message.proto: Import "github.com/gogo/protobuf/gogoproto/gogo.proto" was not found or had errors.


what should i do now ?


Walter Schulze

unread,
Aug 31, 2015, 3:59:05 AM8/31/15
to ruia...@gmail.com, gogoprotobuf, Hamish Ogilvy
Could you please include the imports of your message.proto?

Also when using gogoproto extensions you should use gogofast_out.
gofast_out is only for when you are not using any extensions, but want some extra speed.
I have an issue where I should doc this more clearly

BFH - Benefit For Humanity

unread,
Jul 31, 2024, 11:02:05 AM7/31/24
to gogoprotobuf

Hi Walter,

I am working on a blockchain project that is written in GO and uses gRPC gateway and protocol buffers. I am facing the same issues as above where I am getting the  below errors. Also I am importing a few third party proto files that are in other repos. I have included them in the same proto directory and not sure how to handle them. Please advise. FYI protoc is working fine

[@localhost auction]$ /home/user/go/bin/protoc --gogo_out=. auction.proto
github.com/gogo/protobuf/gogoproto/gogo.proto: File not found.
cosmos/base/v1beta1/coin.proto: File not found.
auction.proto:4:1: Import "github.com/gogo/protobuf/gogoproto/gogo.proto" was not found or had errors.
auction.proto:5:1: Import "cosmos/base/v1beta1/coin.proto" was not found or had errors.
auction.proto:64:12: "cosmos.base.v1beta1.Coin" is not defined.

Do I need to run the MAKEFILE before running protoc?

Walter Schulze

unread,
Jul 31, 2024, 11:11:54 AM7/31/24
to BFH - Benefit For Humanity, gogoprotobuf
You need to include a proto_path which points to all your dependencies.
This includes your file, gogoproto.proto (your file depends on this) and descriptor.proto (gogoproto.proto depends on this).
See the -I flag of protoc

Reply all
Reply to author
Forward
0 new messages