|
|
|
|
|
by apta
2199 days ago
|
|
The following line in golang ignores the error: fmt.Println("foo")
Compare to a language with exception handling where an exception will get thrown and bubbles up the stack until it either hits a handler, or crashes the program with a stack trace.And I was referring to accidental ignoring. I've seen variations of the following several times now: res, err := foo("foo")
if err != nil { ... }
if res != nil { ... }
res, err = foo("bar")
if res != nil { ... }
|
|
>The following line in golang ignores the error:
fmt.Println() is blacklisted for obvious reasons, but this: results in: >And I was referring to accidental ignoring. I've seen variations of the following several times now: results in: