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

Question: Already defined dependency makes buf generate failed #2715

Open
boy-oo opened this issue Jan 19, 2024 · 0 comments
Open

Question: Already defined dependency makes buf generate failed #2715

boy-oo opened this issue Jan 19, 2024 · 0 comments

Comments

@boy-oo
Copy link

boy-oo commented Jan 19, 2024

It looks like importing github.com/grpc-ecosystem/grpc-gateway/v2/runtime in the code makes buf return a warning. The warning that I receive looks like this:

...
protoc-gen-openapiv2/options/openapiv2.proto:719:7:symbol "grpc.gateway.protoc_gen_openapiv2.options.Scopes.ScopeEntry.key" already defined at vendor/github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options/openapiv2.proto:719:7
protoc-gen-openapiv2/options/openapiv2.proto:719:15:symbol "grpc.gateway.protoc_gen_openapiv2.options.Scopes.ScopeEntry.value" already defined at vendor/github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options/openapiv2.proto:719:15
protoc-gen-openapiv2/options/openapiv2.proto:719:23:symbol "grpc.gateway.protoc_gen_openapiv2.options.Scopes.ScopeEntry" already defined at vendor/github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options/openapiv2.proto:719:23
protoc-gen-openapiv2/options/openapiv2.proto:719:23:symbol "grpc.gateway.protoc_gen_openapiv2.options.Scopes.scope" already defined at vendor/github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options/openapiv2.proto:719:23

Is there any way to resolve this?

These are buf.yaml and buf.gen.yaml that I use:

# buf.yaml

version: v1
name: buf.build/my-squad/my-api
deps:
  - buf.build/googleapis/googleapis
  - buf.build/grpc-ecosystem/grpc-gateway
breaking:
  use:
    - FILE
lint:
  use:
    - DEFAULT
# buf.gen.yaml

version: v1
plugins:
  - plugin: go
    out: .
    opt:
      - paths=source_relative
  - plugin: go-grpc
    out: .
    opt:
      - paths=source_relative
  - plugin: grpc-gateway
    out: .
    opt:
      - paths=source_relative
      - generate_unbound_methods=true
  - plugin: openapiv2
    out: openapiv2
    opt:
      - use_go_templates=true
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

1 participant