nicolaferraro commented on a change in pull request #866: camel-rest should 
load automatically for routes using Rest DSL
URL: https://github.com/apache/camel-k/pull/866#discussion_r306835612
 
 

 ##########
 File path: pkg/metadata/metadata.go
 ##########
 @@ -31,39 +31,32 @@ import (
 // ExtractAll returns metadata information from all listed source codes
 func ExtractAll(catalog *camel.RuntimeCatalog, sources []v1alpha1.SourceSpec) 
IntegrationMetadata {
        // neutral metadata
-       meta := IntegrationMetadata{
-               Metadata: src.Metadata{
-                       FromURIs:     []string{},
-                       ToURIs:       []string{},
-                       Dependencies: []string{},
-               },
-               PassiveEndpoints:    true,
-               RequiresHTTPService: false,
-       }
+       meta := NewIntegrationMetadata()
+       meta.PassiveEndpoints = true
+       meta.RequiresHTTPService = false
+
        for _, source := range sources {
                meta = merge(meta, Extract(catalog, source))
        }
        return meta
 }
 
 func merge(m1 IntegrationMetadata, m2 IntegrationMetadata) IntegrationMetadata 
{
-       deps := make(map[string]bool)
-       for _, d := range m1.Dependencies {
-               deps[d] = true
-       }
-       for _, d := range m2.Dependencies {
-               deps[d] = true
-       }
-       allDependencies := make([]string, 0)
-       for k := range deps {
-               allDependencies = append(allDependencies, k)
-       }
-       sort.Strings(allDependencies)
+       d := strset.Union(m1.Dependencies, m2.Dependencies)
+
+       f := make([]string, len(m1.FromURIs)+len(m2.FromURIs))
+       f = append(f, m1.FromURIs...)
+       f = append(f, m2.FromURIs...)
+
+       t := make([]string, len(m1.ToURIs)+len(m2.ToURIs))
 
 Review comment:
   ```suggestion
        t := make([]string, 0, len(m1.ToURIs)+len(m2.ToURIs))
   ```

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


With regards,
Apache Git Services

Reply via email to