CrowdStrike / csproto

CrowdStrike's Protocol Buffers library
MIT License
122 stars 13 forks source link

Resolves actual package name instead of plain import #123

Closed biosvs closed 1 year ago

biosvs commented 1 year ago

Protobuf-go uses "go_package" option and protoc arguments (-Mfile.proto=new_import;pck_name) to compile properties of package: physical import path and package name.

Currently csProto relies on import path only, but ignores package name. This PR fixes this issue.

Unfortunately, I didn't find unit tests for generator itself, so I didn't write tests either.

(Condition around imports added for cases when proto file doesn't contain any messages - for example, only list of enums. Currently it leads to uncompilable code - "imported but not used". I decided that it can be fit into one PR as I'm fixing imports.)

Fixes #121

dylan-bourque commented 1 year ago

Closing because this logic has been integrated into #126.