Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

--go_out: protoc-gen-go: plugins are not supported; use 'protoc --go-grpc_out=...' to generate gRPC` #1104

Open
dasboogles opened this issue Apr 22, 2022 · 3 comments

Comments

@dasboogles
Copy link

  • Found your repo researching grpc-web solutions to setup an Angular (or Vue) project with Go + gRPC.
  • Setup a new Golang environment, test with other Go projects, seems to work fine for normal Go projects
  • Pulled this repo
  • Changed directory down into the client/grpc-web-react-example and read the Readme.md
  • Ran npm install, no errors
  • Ran npm start, error:
[email protected] start
npm run build:proto && concurrently --kill-others "go run go/exampleserver/exampleserver.go" "npm run webpack-dev"

[email protected] build:proto
./protogen.sh

Optional env var GOBIN is not set; using default derived from GOPATH as: "/Users/<myusername>/go/bin"
./protogen.sh: line 24: cd: ../../vendor/github.com/golang/protobuf: No such file or directory
Compiling protobuf definitions
protoc-gen-go: unable to determine Go import path for "examplecom/library/book_service.proto"

Please specify either:
	• a "go_package" option in the .proto source file, or
	• a "M" argument on the command line.
  • Ran go mod vendor
  • Added: option go_package = "./"; @ line 4 of proto/examplecom/library/book_service.proto
  • Now I get the error:
[email protected] start
npm run build:proto && concurrently --kill-others "go run go/exampleserver/exampleserver.go" "npm run webpack-dev"


[email protected] build:proto
./protogen.sh

Optional env var GOBIN is not set; using default derived from GOPATH as: "/Users/jamesbenson/go/bin"
make: *** No rule to make target `install'.  Stop.
Compiling protobuf definitions
--go_out: protoc-gen-go: plugins are not supported; use 'protoc --go-grpc_out=...' to generate gRPC`

Looking to strongly advocate for using Go+gRPC at my job, but i've had trouble finding useable projects to learn from. This looked like the "defacto" project to learn from, however the documentation only appears to be "Feature Documentation" and it doesn't appear to be up-to-date?

Has Improbable moved away from Go+gRPC (or simply gRPC in general)?

Cheers!

@dasboogles dasboogles changed the title protoc-gen-go: unable to determine Go import path for "examplecom/library/book_service.proto" --go_out: protoc-gen-go: plugins are not supported; use 'protoc --go-grpc_out=...' to generate gRPC` Apr 22, 2022
@johanbrandhorst
Copy link
Contributor

Hi, thanks for your issue! First, let me make clear that I don't speak for Improbable, I never worked there, and I don't know what they do internally. This repository has bitrot a bit since it was first created, and the protobuf generation in particular is an area that could use some work. I'm sorry you had a bad experience, but I would generally recommend not using this repository as a model for anything right now.

That said, Go+gRPC+gRPC-web is a really great combination, whether you use the client/proxy from this repository or not. I don't know if I have any good modern example projects to point to (I might create one, separate from this project 🤔), but generally it's "just" a matter of getting the generation working and then hosting the client somewhere where you can reach the server. I have an example that uses a different client here: https://github.com/johanbrandhorst/grpcweb-example/blob/master/main.go, but it's also a bit old so I wouldn't use it for anything other than inspiration.

Your immediate problem is because you're using a different version of protoc-gen-go than this repository does. protoc-gen-go installed from https://pkg.go.dev/google.golang.org/protobuf/ do not support using the plugins=grpc parameter. You could try running go install github.com/golang/protobuf/protoc-gen-go from the root of this repository and it should give you the right version (I think)? We should just replace all of that with a more reproducible scenario, but unfortunately this repository hasn't really seen the love it deserves for a while.

@johanbrandhorst
Copy link
Contributor

I went and made an example repo of using Go, React/TS and gRPC-Web - it uses a different client library, but it is using our proxy in the backend: https://github.com/johanbrandhorst/grpc-web-go-react-example.

@dasboogles
Copy link
Author

I went and made an example repo of using Go, React/TS and gRPC-Web - it uses a different client library, but it is using our proxy in the backend: https://github.com/johanbrandhorst/grpc-web-go-react-example.

Thanks for all of the feedback and info Johan! I'll definitely give your repo a dig!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants