You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by GitBox <gi...@apache.org> on 2019/07/24 14:23:06 UTC
[GitHub] [camel-k] nicolaferraro commented on a change in pull request #866:
camel-rest should load automatically for routes using Rest DSL
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_r306835406
##########
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))
Review comment:
```suggestion
f := make([]string, 0, len(m1.FromURIs)+len(m2.FromURIs))
```
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services