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

Add zero_override field option #13

Merged
merged 2 commits into from
Dec 3, 2022
Merged

Add zero_override field option #13

merged 2 commits into from
Dec 3, 2022

Conversation

borosr
Copy link

@borosr borosr commented Dec 2, 2022

#12
I added zero_override to the field options. This manipulates the getters default return value directory. So based on the example from the ticket, if you are extending the message's field like this:

message Anything {
  string something = 1 [(go_type) = "Something", (go_import) = "", (zero_override)="\"\""];
}

You will get the following result in the related getter:

type Anything struct {
	Something Something

func (x *Anything) GetSomething() Something {
	if x != nil {
		return x.Something
	}
	return ""
}

@borosr borosr added the bug Something isn't working label Dec 2, 2022
@borosr borosr requested a review from PumpkinSeed December 2, 2022 13:34
@borosr borosr self-assigned this Dec 2, 2022
@PumpkinSeed PumpkinSeed merged commit bb44b2b into master Dec 3, 2022
@PumpkinSeed PumpkinSeed deleted the 12-fix-zero-value branch December 3, 2022 09:30
@PumpkinSeed PumpkinSeed linked an issue Dec 18, 2022 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Invalid return generation for Getter
2 participants