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


##########
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:
   Yes, I see. For the sake of making the thing in a clean way, I can copy the 
array and sorting/comparing them. It should not be too heavy from a computation 
pov and it will save us against remote (but still possible) inconsistencies.



-- 
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]

Reply via email to