astefanutti edited a comment on pull request #2766:
URL: https://github.com/apache/camel-k/pull/2766#issuecomment-976237140
@lburgazzoli the closure pattern looks good.
To be honest, even the "plain procedural" approach looks good to me:
```go
f, err := os.Create("path")
if err != nil {
return err
}
if err = io.WriteString(f, "hello world"); err != nil {
f.Close()
return err
}
return f.Close()
```
Sometimes, no-pattern is the best pattern, and I find it a bit ironic the
hype with `defer` biased us to use it brokenly, in contradiction with the
general Golang philosophy, that aims for minimalism and robustness, like with
error handling for example.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]