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

Multiple packages with the same "leaf" package name can cause go.lint options to be ignored. #92

Open
bithoarder opened this issue Oct 14, 2022 · 0 comments

Comments

@bithoarder
Copy link

bithoarder commented Oct 14, 2022

If multiple packages have the same "leaf" package name (package1/messages/, package2/messages/), then the linting will sometimes be skipped for one of the packages.

It's easiest to describe with a small example:

v1/a/test.proto:

syntax = "proto3";
package test.v1.a;
option go_package = "foo/bar/v1/a";

v2/a/anothertest.proto:

syntax = "proto3";
package test.v1.a;
option go_package = "foo/bar/v2/a";

import "patch/go.proto";
option (go.lint).all = true;

enum SomeEnum {
  SOME_ENUM_UNDEFINED = 0;
  SOME_ENUM_FOO = 1;
}

Then, depending on the order the proto files are supplied to protoc, the generated enum might not be linted.

this failed to lint the enum:
protoc -I . --go-patch_out=plugin=go,paths=source_relative:.make v2\a\anothertest.proto v1\a\test.proto
this works:
protoc -I . --go-patch_out=plugin=go,paths=source_relative:.make v2\a\test.proto v1\a\anothertest.proto

I think this is because Patcher.packagesByName is only keyed by the "leaf" package name, and thus gets overwritten.

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