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

Extra struct content #179

Closed

Conversation

AudriusButkevicius
Copy link

No description provided.

option (gogoproto.sizer_all) = true;

message ExtraStructContent {
option (gogoproto.extra_struct_content) = "MyMagicValue int64\nMyOtherMagicValue string";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm, looks good, but is there some way we could have a raw string?

option (gogoproto.extra_struct_content) = `
MyMagicValue int64
MyOtherMagicValue string
`;

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does not seem the protobuf spec supports that.

@awalterschulze
Copy link
Member

Looks really good :)

@stevvooe
Copy link
Contributor

Rather than taking a raw Go string, would it be better to take a structured option? Check out [https://github.com/googleapis/googleapis/blob/master/google/api/annotations.proto#L26] for an example and the syntax. Basically, you would have an inline structure with a list of types and names for the extra fields. It would probably be a little more robust and nicer to read.

@AudriusButkevicius
Copy link
Author

Sadly it's above my understanding of proto syntax, so you either need to provide better examples or walk me there.

But before we do that, I'd need an acknowledgement that this new version would be merged upstream as a justification for me to spend the effort. Current version already works for my needs, and the only benefits I could reap from the new version would be not having to maintain a fork.

@awalterschulze
Copy link
Member

I'll say it definitely increases the chances. But I can't make a guarantee
and I still want at least another user
On 16 May 2016 9:42 PM, "Audrius Butkevicius" notifications@github.com
wrote:

Sadly it's above my understanding of proto syntax, so you either need to
provide better examples or walk me there.

But before we do that, I'd need an acknowledgement that this new version
would be merged upstream as a justification for me to spend the effort.
Current version already works for my needs, and the only benefits I could
reap from the new version would be not having to maintain a fork.


You are receiving this because you commented.
Reply to this email directly or view it on GitHub
#179 (comment)

@stevvooe
Copy link
Contributor

@AudriusButkevicius Here is an example of the syntax. I would hope you would take the time to explore other approaches before pushing for merging this. The current suggestion just seems very fragile.

@awalterschulze
Copy link
Member

I am guessing you found another solution. I am closing this, but please comment if want to continue work.

@AudriusButkevicius AudriusButkevicius deleted the extra_struct_content branch September 10, 2016 09:09
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 this pull request may close these issues.

3 participants