protoc can't import proto file in the same directory

949 views
Skip to first unread message

Vetch

unread,
Aug 7, 2022, 9:40:04 PM8/7/22
to Protocol Buffers
I copied all the files in https://github.com/helium/proto/tree/master/src to my local machine, when i try to generate code for my golang project, protoc throw some error.

protoc --version: libprotoc 3.21.4, downloaded from github
language i am using: Go

steps to reproduce:

working path:

$ pwd 
/c/User/Desktop/test/src

proto files in this path:

$ ls 
blockchain_block.proto 
blockchain_block_v1.proto 
blockchain_txn.proto  ......

protoc cmd i tried:

$ protoc --go_out=/c/User/Desktop/Helium/hnt/ ./blockchain_block.proto
$ protoc --proto_path=. --go_out=/c/User/Desktop/Helium/hnt/ ./blockchain_block.proto
$ protoc --proto_path=/c/User/Desktop/test/src --go_out=/c/User/Desktop/Helium/hnt/ /c/User/Desktop/test/src/blockchain_block.proto

protoc output:

blockchain_block_v1.proto:21:12: "blockchain_txn" is not defined. blockchain_block.proto:4:1: Import "blockchain_block_v1.proto" was not found or had errors. blockchain_block.proto:7:17: "blockchain_block_v1" is not defined.

I can compile most proto file in https://github.com/helium/proto/tree/master/src, except for blockchain_block.proto and blockchain_block_v1.proto
How do i fix this?

ritesh singh

unread,
Feb 24, 2023, 12:55:57 PM2/24/23
to Protocol Buffers
Hi Vetch, 

Were you able to fix it?
Reply all
Reply to author
Forward
0 new messages