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


##########
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, but in this case I don't think it's a problem. This func is not 
directly used by the trait per se but is a supporting function used in the 
`matchesComparableTrait` func. Here what we do is to create 2 brand new traits 
which are only used for comparison, so, I tend to think they are not really 
affecting the rest of the execution as they are 2 new objects:
   
   
https://github.com/apache/camel-k/pull/5230/files#diff-80f4821d91dcccf8c11c32962f56b41b7dcfccadeb6366df3cf49baa55188ba1R637-R658
   
   I think the structure backing the two object is different. But I may be 
wrong. If you feel we need to prove it I can try to develop a unit test to make 
sure this is not happening. Thanks.



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