6 ms·
you could use an `else` clause for the scope: if foo, err := doThing(bar); err != nil { // handle error } else { // handle foo } but most don'
by mweibel 5y ago
you could use an `else` clause for the scope:
if foo, err := doThing(bar); err != nil {
// handle error
} else {
// handle foo
}
but most don't use that form and just do the call outside:
foo, err := doThing(bar)
if err != nil {
// handle error
}
- cratermoon 5y agoor pass doThing as a function parameter https://play.golang.org/p/4PoK6EZc4W9 https://play.golang.org/p/4PoK6EZc4W9