protoc-gen-star icon indicating copy to clipboard operation
protoc-gen-star copied to clipboard

Incorrect handling of import_path when it is a path

Open johanbrandhorst opened this issue 4 years ago • 0 comments

In the rare case where import_path is used to indicate the full import path of a package, protoc-gen-star incorrectly uses the full path in the PackageName() function, generating invalid code.

The correct behaviour is to remove anything before the last slash in the path, and use this as the package name. See https://github.com/golang/protobuf/blob/v1.4.2/protoc-gen-go/generator/generator.go#L637-L643 for evidence of this behaviour in protoc-gen-go.

I intend to submit a fix for this.

johanbrandhorst avatar Jun 08 '20 11:06 johanbrandhorst