tadayosi commented on pull request #1850: URL: https://github.com/apache/camel-k/pull/1850#issuecomment-742216563
> Can I suggest that we remove default trait fields initialisation from the trait factory methods? I now see it as an anti-pattern somehow, and the defaulting logic would be better move into the Configure method. That would also prevent using that lovely &[]bool{true}[0] construct :wink:. After investigation I realised that it's not as easy as I initially thought. It's because each trait's `Configure` method is invoked _after_ the trait catalog's `configure` has already been invoked, and it is where the trait is initialised with the trait configuration from an integration. https://github.com/apache/camel-k/blob/master/pkg/trait/trait_catalog.go#L109 It's still possible to move the defaulting logic to `Configure` method but the logic would then require checking on each property whether it's already initialised with the value from an integration to make sure it wouldn't override already configured values, and I'd say it's more error-prone than the current code. Instead I just removed this fancy `&[]bool{true}[0]` initialisation with the latest commit for the time being. ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org