You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by GitBox <gi...@apache.org> on 2021/11/23 08:01:06 UTC

[GitHub] [camel-k] astefanutti commented on pull request #2766: gosec

astefanutti commented 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 use to use it brokenly, in contradiction with the general Goland 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: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org