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

proto: Support map fields #381

Open
euroelessar opened this issue Aug 23, 2021 · 2 comments · May be fixed by #511
Open

proto: Support map fields #381

euroelessar opened this issue Aug 23, 2021 · 2 comments · May be fixed by #511

Comments

@euroelessar
Copy link

There is a TODO in the codebase, so I assume the support is desired.
https://github.com/google/starlark-go/blob/master/lib/proto/proto.go#L84

There are two primary questions in regard of the possible implementation:

  1. Ensuring deterministic ordering is tricky, the only feasible way is to sort all keys before the iteration (meaning lexicographical order as in opposite to the insertion one in regular dicts).
  2. Are there any tests for the package? Where should they be put?
@tazjin
Copy link
Contributor

tazjin commented Jul 25, 2023

I'm very interested in sorting this out at the moment, at least for message initialisation. @adonovan, would you accept a PR for this? (CLA is on file, and I'm a Xoogler).

@tazjin
Copy link
Contributor

tazjin commented Jul 25, 2023

Turned out to be fairly easy, map construction is here: #491

It seems like there isn't great test coverage of the lib/proto functionality at the moment. Didn't touch that too much. This code exists in a private fork, too, and has been tested against some fairly complex protos with map fields there.

@negz negz linked a pull request Oct 2, 2023 that will close this issue
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.

2 participants