Skip to content

protoc-gen-grpc-gateway: can't generate gateway stubs for multiple packages in one go #1612

Closed
@adambabik

Description

@adambabik

🐛 Bug Report

I would like to execute protoc with protoc-gen-grpc-gateway to generate stubs for all my packages in one go. Unfortunately, I am getting an error: --grpc-gateway_out: inconsistent package names: av1 bv1.

To Reproduce

  1. Organize the packages like this:
proto
└── my-org
    ├── a
    │   └── v1
    │       └── a.proto
    └── b
        └── v1
            └── b.proto

where a.proto's package is av1 and b.proto's package name is bv1.

  1. Execute protoc in the following way:
protoc \
    -I=/proto \
    -I=/third_party \
    --go_opt=paths=source_relative \
    --go_out=/gen \
    --go-grpc_opt=paths=source_relative \
    --go-grpc_out=/gen \
    --grpc-gateway_out=paths=source_relative,logtostderr=true:/gen \
    --validate_out=paths=source_relative,lang=go:/gen \
    $(find /proto -name '*.proto')

Expected behavior

I expect to have grpc-gateway stubs generated in corresponding directories.

Actual Behavior

I am getting an error --grpc-gateway_out: inconsistent package names: av1 bv1. However, when executing the protoc command package-by-package, it seems that the stubs are generated properly in the corresponding directories in accordance with paths=source_relative.

Your Environment

I execute this in a Docker container. It uses golang:1.14-stretch as a base image.

The version of protoc-gen-grpc-gateway is v1.14.7.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions