2

I'm trying to run makefile command 'gen' from this project https://github.com/penthaapatel/grpcblog. The command is: protoc --go_out=. --go_opt=paths=source_relative --go-grpc_out=. --go-grpc_opt=paths=source_relative blog/blog.proto However I get an error:

protoc-gen-go-grpc: program not found or is not executable --go-grpc_out: protoc-gen-go-grpc: Plugin failed with status code 1. make: *** [/home/deckard/go/src/grpcblog/Makefile:2: gen] Error 1 

I use Ubuntu 20.04? Golang-1.13.8 with $GOROOT=/usr/lib/go-1.13 and $GOPATH=/home/deckard/go ($HOME is /home/deckard). Protoc is libprotoc v.3.6.1.. I installed protobuf-compiler both with:

sudo apt install protobuf-compiler 

and

go get -u github.com/golang/protobuf/{proto,protoc-gen-go} 

There's a folder /home/deckard/go/src/github.com/golang/protobuf and /home/deckard/go/src/google.golang.org/protobuf with /home/deckard/go/src/google.golang.org/protobuf, with, I guess, everything i need. My bashrc configurations (tried few methods, so things overlap each other):

export GOROOT=/usr/lib/go-1.13 export GOPATH=$HOME/go export GOBIN=$GOPATH/bin export PATH=$PATH:$GOROOT:$GOPATH:$GOBIN export PATH=$PATH:$GOPATH/bin export GO_PATH=~/go export PATH=$PATH:/$GO_PATH/bin 

So i tried solutions from here: protoc-gen-go: program not found or is not executable, but none of them helped me. Any clue would be helpful, because I stuck and am very tired.

UPDATE: ls -l /home/deckard/go/bin/protoc-gen-go-grpc shows rwxrwxr-x 1 deckard deckard 7970222 мая 1 14:55 /home/deckard/go/bin/protoc-gen-go-grpc, and printenv PATH returns /home/deckard/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/deckard/.dotnet/tools:/usr/lib/go-1.13:/home/deckard/go:/home/deckard/go/bin:/home/deckard/go/bin://home/deckard/go/bin

UPDATE: which protoc returns /usr/bin/protoc (tried to install it from precompiled binary to /home/deckard/.local/bin/protoc, didn't helped). In both cases protoc-gen-go-grpc --version returns protoc-gen-go-grpc 1.1.0. I also tried to copy everything from google.golang.org/protobuf to google.golang.org/protobuf, no result.

3
  • Please add the output from ls -l /home/deckard/go/bin/protoc-gen-go-grpc and printenv PATH to your question. Commented May 1, 2021 at 20:42
  • Thanks - your path has a few issues (duplicates, invalid path); I doubt that is the issue but probably worth tidying up. Please run which protoc (just in case snap version running) and protoc-gen-go-grpc --version (cant read the permissions due to language so this just confirms it runs). Note that you should consider moving from github.com/golang/protobuf to google.golang.org/protobuf (latest protoc may also be a worthwhile upgrade). Commented May 2, 2021 at 10:59
  • @Brits updated question and looks like I solved my problem. Thank you very much. Commented May 2, 2021 at 14:22

1 Answer 1

1

So I deleted github.com/golang/protobuf folder, and seems like google.golang.org/protobuf has started indexing, and everything just started working.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.