2
0
Эх сурвалжийг харах

Use buffered channels for detection results

Mohammed Nafees 4 жил өмнө
parent
commit
2ae2c02882

+ 2 - 5
internal/integrations/buildpacks/go.go

@@ -24,6 +24,7 @@ func (runtime *goRuntime) detectMod(results chan struct {
 		name := directoryContent[i].GetName()
 		if name == "go.mod" {
 			goModFound = true
+			break
 		}
 	}
 	if goModFound {
@@ -98,11 +99,7 @@ func (runtime *goRuntime) Detect(
 		return nil
 	}
 
-	detected := make(map[string]bool)
-	for result := range results {
-		detected[result.string] = result.bool
-	}
-
+	fmt.Printf("Go runtime detected for %s/%s\n", owner, name)
 	paketo.Detected = append(paketo.Detected, paketoBuildpackInfo)
 	heroku.Detected = append(heroku.Detected, herokuBuildpackInfo)
 

+ 1 - 1
internal/integrations/buildpacks/nodejs.go

@@ -167,7 +167,7 @@ func (runtime *nodejsRuntime) Detect(
 	results := make(chan struct {
 		string
 		bool
-	})
+	}, 3)
 
 	fmt.Printf("Starting detection for a NodeJS runtime for %s/%s\n", owner, name)
 	runtime.wg.Add(3)

+ 1 - 1
internal/integrations/buildpacks/python.go

@@ -118,7 +118,7 @@ func (runtime *pythonRuntime) Detect(
 	results := make(chan struct {
 		string
 		bool
-	})
+	}, 4)
 
 	fmt.Printf("Starting detection for a Python runtime for %s/%s\n", owner, name)
 	runtime.wg.Add(4)

+ 3 - 1
internal/integrations/buildpacks/ruby.go

@@ -188,6 +188,8 @@ func (runtime *rubyRuntime) Detect(
 	repoContentOptions github.RepositoryContentGetOptions,
 	paketo, heroku *BuilderInfo,
 ) error {
+	fmt.Printf("Starting detection for a Ruby runtime for %s/%s\n", owner, name)
+
 	gemfileFound := false
 	gemfileLockFound := false
 	configRuFound := false
@@ -249,7 +251,7 @@ func (runtime *rubyRuntime) Detect(
 	results := make(chan struct {
 		string
 		bool
-	})
+	}, count)
 
 	fmt.Printf("Starting detection for a Ruby runtime for %s/%s\n", owner, name)
 	runtime.wg.Add(count)