You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Go clearly defines what the "default" or "zero" value of a type is, whether it be 0, "", false, nil or whatever. With this in mind, consider the following code snippet:
I propose that we allow the _ character to represent the default, or "zero" value, of a given type when returning from a function. This would amend the original example to the following:
This change would reduce time spent checking return types and their default values (when I first started learning Go, returning time.Time{ } for an empty time really threw me). I feel this change would also be semantically meaningful with the current uses for the _ symbol.