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

Incorrect handling of import_path when it is a path #77

Open
johanbrandhorst opened this issue Jun 8, 2020 · 0 comments
Open

Incorrect handling of import_path when it is a path #77

johanbrandhorst opened this issue Jun 8, 2020 · 0 comments

Comments

@johanbrandhorst
Copy link

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 added a commit to johanbrandhorst/protoc-gen-star that referenced this issue Jun 8, 2020
This change makes protoc-gen-star conform to the behaviour
of protoc-gen-go in the presence of an import_path
parameter that contains slashes.

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.

Fixes lyft#77
johanbrandhorst added a commit to johanbrandhorst/protoc-gen-star that referenced this issue Jun 8, 2020
This change makes protoc-gen-star conform to the behaviour
of protoc-gen-go in the presence of an import_path
parameter that contains slashes.

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.

Fixes lyft#77
johanbrandhorst added a commit to johanbrandhorst/protoc-gen-star that referenced this issue Aug 6, 2020
This change makes protoc-gen-star conform to the behaviour
of protoc-gen-go in the presence of an import_path
parameter that contains slashes.

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.

Fixes lyft#77
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

Successfully merging a pull request may close this issue.

1 participant