-
Notifications
You must be signed in to change notification settings - Fork 18.5k
Closed
Labels
FrozenDueToAgeLanguageChangeSuggested changes to the Go languageSuggested changes to the Go languageProposalerror-handlingLanguage & library change proposals that are about error handling.Language & library change proposals that are about error handling.v2An incompatible library changeAn incompatible library change
Milestone
Description
Add an assignment symbol (-) that returns a named variable if it's not it's zero value. This is definitely NOT an error proposal. If you think it is, I know a doctor who can check your eyes for you. For free! Call me, 😉.
The zero value of an error (which is a value) is nil.
func bezo(baller, dollers string) error {
bucko, - := strconv.Atoi(baller)
bucks, _ := strconv.Atoi(dollers)
fmt.Println("$:", bucko + bucks)
return nil
}The supreme art of war is to subdue the enemy without fighting. Let them handle their errors.
— Sun Tzu
Implications: #52380
DeedleFake
Metadata
Metadata
Assignees
Labels
FrozenDueToAgeLanguageChangeSuggested changes to the Go languageSuggested changes to the Go languageProposalerror-handlingLanguage & library change proposals that are about error handling.Language & library change proposals that are about error handling.v2An incompatible library changeAn incompatible library change