lburgazzoli commented on code in PR #5230:
URL: https://github.com/apache/camel-k/pull/5230#discussion_r1517349545


##########
pkg/trait/builder.go:
##########
@@ -56,9 +57,18 @@ func (t *builderTrait) InfluencesKit() bool {
        return true
 }
 
-// InfluencesBuild overrides base class method.
-func (t *builderTrait) InfluencesBuild(this, prev map[string]interface{}) bool 
{
-       return true
+func (t *builderTrait) Matches(trait Trait) bool {
+       otherTrait, ok := trait.(*builderTrait)
+       if !ok {
+               return false
+       }
+       if t.BaseImage != otherTrait.BaseImage || len(t.Properties) != 
len(otherTrait.Properties) {
+               return false
+       }
+       // More sofisticated check if len is the same. Sort and compare via 
slices equal func.
+       slices.Sort(t.Properties)
+       slices.Sort(otherTrait.Properties)

Review Comment:
   That would be a sensible option.
   
   Another one, but would require some more work so I don't think it is worth 
at this stage, could be to do something similar what it is done in the golang 
standard library where there is often the possibility to pass a function for 
equality, sorting, etc. like https://pkg.go.dev/slices#EqualFunc
   



-- 
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-unsubscr...@camel.apache.org

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

Reply via email to