Re: [protobuf] Re: Message imports from different locations and stub generation

2018-08-30 Thread Dzintars Klavins
Thank You for reply.

I already figured out this stuff. Real problem was/is in VS Code terminal. 
When i run protoc command from VS Code there is some issue with imports ... 
or not sure with what exactly.
When no .proto imports are used, VS Code terminal was working just great 
with protoc.
But after i included some .proto imports from other directories i get that 
proto-gen-go error listed above.

So at the end i tried to run the same command from CMD and PowerShell stand 
alone terminals and it works just great.
So, the issue is related to VS Code.

My Environment Variables are set correctly.


On Tuesday, August 28, 2018 at 10:42:17 PM UTC+3, Feng Xiao wrote:
>
> I have written some explanation of protoc "-I" flag and import path here:
> https://github.com/xfxyjwf/protobuf/blob/protoc/docs/protoc.md
>
>  To run protoc correctly:
> 1. Determine the import path for every one of your .proto files. In your 
> case, I think it should be "dms/v1/dms.proto" and "metric/protobuf.proto".
> 2. Use the chosen import paths in all your .proto files. E.g., change your 
> dms.proto to use 'import "metric/protobuf.proto";' instead.
> 3. Construct "--proto_path" arguments where protoc can find the imported 
> files using the chosen import paths. In your case, it should be "-I." which 
> can be omitted because it's the default.
>
> Putting everything together:
> a. change dms.proto to do 'import "metric/protobuf.proto";'
> b. run 'protoc dms/v1/dms.proto --go_out=..."
>
> and it should work.
>
> The other error:
> --go_out: protoc-gen-go: The system cannot find the file specified.
>
> is about missing the go protoc plugin. You should be able to fix that by 
> installing the right plugin and make sure it can be found in PATH. If in 
> doubt, check:
>
> $ which protoc-gen-go
>
> If it prints nothing, your go protoc plugin is not installed correctly.
>
> On Tue, Aug 28, 2018 at 5:05 AM Dzintars Klavins  > wrote:
>
>> And when i am using:
>>>
>>  
>> protoc --proto_path=dms/v1 dms.proto --go_out=plugins=grpc:D:\Code\Go\src
>>  
>>
>> i get a error: 
>>
>> protobuf.proto: File not found.
>> dms.proto: Import "protobuf.proto" was not found or had errors.
>> dms.proto:17:66: "domain.protobuf.Empty" is not defined.
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Protocol Buffers" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to protobuf+u...@googlegroups.com .
>> To post to this group, send email to prot...@googlegroups.com 
>> .
>> Visit this group at https://groups.google.com/group/protobuf.
>> For more options, visit https://groups.google.com/d/optout.
>>
>

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


[protobuf] Re: Message imports from different locations and stub generation

2018-08-28 Thread Dzintars Klavins

>
> And when i am using:
>
 
protoc --proto_path=dms/v1 dms.proto --go_out=plugins=grpc:D:\Code\Go\src 

i get a error: 

protobuf.proto: File not found.
dms.proto: Import "protobuf.proto" was not found or had errors.
dms.proto:17:66: "domain.protobuf.Empty" is not defined.

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


[protobuf] Message imports from different locations and stub generation

2018-08-28 Thread Dzintars Klavins
Hi,

All this morning digging around *protoc *file generation.

Would like to ask, what is proper syntax of generation stubs in my case.

My current location is %GOPATH%\src\github.com\domain\proto

And structure are like this:

[image: ProtocExample.png] 

When i run

 protoc dms/v1/dms.proto -I. --go_out=plugin=grpc:D:\Code\Go\src

i get a error:

*--go_out: protoc-gen-go: The system cannot find the file specified.*

I am not sure what i am doing wrong. I tried many different ways. In same 
cases i get error about that protobuf.proto import which is located in root 
of my repo.
Most interesting, that little bit other structure was working before: protoc 
--go_out=D:/Code/Go/src v1/dms/dms.proto

Could you please share there some great resources to learn about this *protoc 
**import *and *generate* stuff? Official documentation doesn't tell much 
and their example doesn't work for me.
When everything is as single package and in single directory - sure, it 
works well... but when you have some more complicated structure - i didn't 
found much resources about learning this.

Thank you!


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