Skip to content

defer error is ignored #560

@fabianburth

Description

@fabianburth

Context
Here is an example of this issue:
open-component-model/open-component-model#448

If an error is returned in a defer-statement
e.g.

defer func() {
    err = errors.Join(err, ...)
}()

If the error in the assignment is not a named return parameter, the above code does not do anything.

Additional Comments
We have a lot of places in our code like the example given above (typically, we check for io close errors in the defer). We have to find these places and fix them.

Metadata

Metadata

Labels

area/ipceiImportant Project of Common European Interestkind/bugfixBug

Type

No fields configured for Bug.

Projects

Status
🍺 Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions