How to install protoc-gen-go (Go protocol buffer compiler plugin) in windows ?

30,053 views
Skip to first unread message

Aravinth Veeramuthu

unread,
Jun 25, 2015, 5:02:43 AM6/25/15
to golan...@googlegroups.com
How to install protoc-gen-go (Go protocol buffer compiler plugin) in windows ?

I have a problem when i convert the *.proto type protocol buffer file into the *.pb.go format using protoc-gen-go Complier.

I got the following error...

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

Joshua

unread,
Jun 25, 2015, 6:59:56 AM6/25/15
to golan...@googlegroups.com

Aravinth Veeramuthu

unread,
Jun 25, 2015, 7:13:53 AM6/25/15
to golan...@googlegroups.com
I already install it. But my command to create *.pb.go is not working. can you explain it step by step ? 

Joshua

unread,
Jun 25, 2015, 7:29:46 AM6/25/15
to golan...@googlegroups.com
Did you download protoc? protoc uses the protoc-gen-go as a plugin. I usually just use something like this:
   protoc --go_out=. *.proto

Joshua


On Thursday, June 25, 2015 at 5:02:43 AM UTC-4, Aravinth Veeramuthu wrote:

Aravinth Veeramuthu

unread,
Jun 25, 2015, 9:17:51 AM6/25/15
to golan...@googlegroups.com
Yes, I download it.But i have some problem to run the command and it shows --go_out protoc-gen-go : The system cannot find the file specified.
Are u the Windows user or Linux user?

Joshua

unread,
Jun 25, 2015, 9:20:02 AM6/25/15
to golan...@googlegroups.com
I use both. Did you include the %GOPATH%/bin in your %PATH%?

Joshua

Aravinth Veeramuthu

unread,
Jun 25, 2015, 9:21:20 AM6/25/15
to golan...@googlegroups.com
Where i have include those?

Aravinth Veeramuthu

unread,
Jun 25, 2015, 9:22:47 AM6/25/15
to golan...@googlegroups.com
where i have to place my github.com/golang/protobuf/protoc-gen-go this package?

Konstantin Khomoutov

unread,
Jun 25, 2015, 10:34:41 AM6/25/15
to Aravinth Veeramuthu, golan...@googlegroups.com
On Thu, 25 Jun 2015 04:13:52 -0700 (PDT)
Aravinth Veeramuthu <aravinth....@vembu.com> wrote:

> I already install it. But my command to create *.pb.go is not
> working. can you explain it step by step ?

Using a sheer guess, I'd say after bringing in that project, you need
to do

go install github.com/golang/protobuf/protoc-gen-go

while in your {workspace}/src folder.
The program whose source code is now located in

{workspace}/src/github.com/golang/protobuf/protoc-gen-go

will be compiled and installed under the {workspace}/bin folder.

The next sheer guess is that if some tool you're using attempts to
actually call that protoc-gen-go.exe which sould have been compiled on
the previous step, to make it work, you have to append the full path to
your {workspace}/bin folder to the PATH environment variable of your
Windows user. Without this, any external tool which wants to call
protoc-rpc-go.exe would need to know the full path to that tool, which
is unlikely. So you have to add the path of the folder containing that
program to the list contained in the PATH environment variable.

The {workspace} token I'm using is the path to your Go workspace, that
is, the place where your local Go files reside -- as detailed in [1].

1. https://golang.org/doc/code.html

Aravinth Veeramuthu

unread,
Jun 25, 2015, 11:08:05 AM6/25/15
to golan...@googlegroups.com, aravinth....@vembu.com
Still i wont convert the .proto file 

Konstantin Khomoutov

unread,
Jun 25, 2015, 11:47:40 AM6/25/15
to Aravinth Veeramuthu, golan...@googlegroups.com
On Thu, 25 Jun 2015 08:08:04 -0700 (PDT)
Aravinth Veeramuthu <aravinth....@vembu.com> wrote:

> Still i wont convert the .proto file
[...]

Please try to read what you wrote from the standpoint of a person who's
trying to help.



What sort of response do you expect if you provide exactly zero amount
of information about what steps you performed, whether they succeeded
or not, how have you verified they did, what exact command you're
trying to call now, and with which error messages it fails.

Given your "Still i wont convert the .proto file" remark the only
answer you might legitimately expect in return is "So what?".



You should consider reading through [1] to not waste other people's
time. Have fun.

1. http://www.chiark.greenend.org.uk/~sgtatham/bugs.html

Joshua

unread,
Jun 25, 2015, 12:55:47 PM6/25/15
to golan...@googlegroups.com
Here is the step by step directions:
  1. Download protoc-win32.zip from https://developers.google.com/protocol-buffers/docs/downloads
  2. Unzip and add location of the protoc.exe to your PATH environment variable
  3. Run `protoc --version` from command prompt to verify
  4. Verify the your GOPATH environment variable is set
  5. Run `go get -u github.com/golang/protobuf/protoc-gen-go` from command prompt. This should install the binary to %GOPATH%/bin
  6. Add `%GOPATH%/bin` to your PATH environment variable
  7. Open a new command prompt, navigate to your .proto file, run `protoc --go_out=. *.proto` 
NOTE: if you are running from a text editor or ide, you may need to reboot after modifying your environment variables

Aravinth Veeramuthu

unread,
Jun 26, 2015, 6:47:34 AM6/26/15
to golan...@googlegroups.com
Yeah! Now its working.
ThAnK yOu So MuCh :)

m.rost...@gmail.com

unread,
Apr 4, 2020, 4:29:45 PM4/4/20
to golang-nuts
Thank you, the problem was the same and surprisingly it has solved by step 7.  
I have never seen this on a Linux box before, poor Windows. :)

Joseph Hoeller

unread,
Mar 11, 2021, 12:12:59 PM3/11/21
to golang-nuts

whats the path spec for --proto_path for windows, ive been trying to target the go file with its path and im just not getting it in win10 with wsl2 enabled.

Joseph Hoeller

unread,
Mar 22, 2021, 5:13:49 PM3/22/21
to golang-nuts
How do you do this on Windows?

Emerson Paguia

unread,
Apr 11, 2021, 7:33:47 PM4/11/21
to golang-nuts
I am using Ubuntu 20.04, Golang 16.2, then I downloaded the required protobuf release here: https://github.com/protocolbuffers/protobuf/releases/download/v3.15.8/protoc-3.15.8-linux-aarch_64.zip for my system, and extract it in "Download directory", well you say that in No. 2: 

-  Unzip and add location of the protoc.exe to your PATH environment variable, so how was that in Linux?

protoc-gen-go: unable to determine Go import path for ,

well, I just can't get it where is ny PATH environment variable really is,
I did
nano ~/.bashrc
then
source ~/.bashrc
then 
restart my pc

even
nano ~/.zshrc
then
source ~/.zshrc
then 
restart my pc

I also try
nano ~/.profile
then
source ~/.profile
then 
restart my pc

but where?
Reply all
Reply to author
Forward
0 new messages