Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
GitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
I strongly think that a ternary operator is needed on Go
Here is why
I have a struct
I wish to send that struct based on a json marshal like below
Now to send it back this is the long code I have to write
If we had a ternary operator I could have just done this
Thanks for this amazing language though.
This has been discussed before: #33171
If you think you have something new to add, please file a new proposal while filling the form at https://github.com/golang/proposal/blob/master/go2-language-changes.md.
Note that the long code doesnt do the same then the proposed short form as StatusCode and StatusMessage are changed.
starts to look much more complex to me to understand what err vs non err does then the version that uses one