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

feat(options): adds protoc-gen-go-like M option #672

Merged
merged 1 commit into from
Sep 21, 2022

Conversation

iamricard
Copy link
Contributor

@iamricard iamricard commented Sep 20, 2022

This commit adds a new feature that aims to provide the same functionality as M for the go compiler (https://developers.google.com/protocol-buffers/docs/reference/go-generated#package). I opted for not modifying the type map, because we'll also want to figure out whether or not we need to generate the file, so we'll be accessing the options.M everywhere and I found it less confusing to always get mapping information from options.M instead of options.M or the type map depending on the decision that we're making (we need to know if we need to do a relative import or just the raw provided import too).

@stephenh there was an alternative approach I considered: change the type registry module to include information about whether or not the module had been remapped, but that seemed to add more complexity than the option I went with. I'm happy to revisit it though, if you think some other approach would be a better fit for the future of the codebase.

Fixes #596

This commit adds a new feature that aims to provide the same
functionality as `M` for the go compiler (https://developers.google.com/protocol-buffers/docs/reference/go-generated#package).
I opted for not modifying the type map, because we'll also want to
figure out whether or not we need to generate the file, so we'll be
accessing the `options.M` everywhere and I found it less confusing to
always get mapping information from `options.M` instead of `options.M`
or the type map depending on the decision that we're making (we need to
know if we need to do a relative import or just the raw provided
import too).

Fixes stephenh#596
@stephenh
Copy link
Owner

This looks great, thanks @iamricard !

@stephenh stephenh merged commit 9304e5d into stephenh:main Sep 21, 2022
stephenh pushed a commit that referenced this pull request Sep 21, 2022
# [1.126.0](v1.125.0...v1.126.0) (2022-09-21)

### Features

* **options:** adds protoc-gen-go-like M option ([#672](#672)) ([9304e5d](9304e5d)), closes [#596](#596)
@stephenh
Copy link
Owner

🎉 This PR is included in version 1.126.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@iamricard iamricard deleted the ricard/596/create-m-option branch September 21, 2022 07:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature: Importmap option
2 participants