aboutsummaryrefslogtreecommitdiffhomepage
path: root/internal
diff options
context:
space:
mode:
Diffstat (limited to 'internal')
-rw-r--r--internal/pkg/exec.go11
1 files changed, 8 insertions, 3 deletions
diff --git a/internal/pkg/exec.go b/internal/pkg/exec.go
index 29753952..1ace5991 100644
--- a/internal/pkg/exec.go
+++ b/internal/pkg/exec.go
@@ -224,6 +224,11 @@ func (a *execArtifact) cure(c *CureContext, hostNet bool) (err error) {
paths[i].src = make([]*check.Absolute, len(p.A))
}
+ var artifactCount int
+ for _, p := range a.paths {
+ artifactCount += len(p.A)
+ }
+
if len(paths) > 0 {
type cureArtifact struct {
// Index of pending Artifact in paths.
@@ -231,7 +236,7 @@ func (a *execArtifact) cure(c *CureContext, hostNet bool) (err error) {
// Pending artifact.
a Artifact
}
- ac := make(chan cureArtifact, len(paths))
+ ac := make(chan cureArtifact, artifactCount)
for i, p := range a.paths {
for j, d := range p.A {
ac <- cureArtifact{[2]int{i, j}, d}
@@ -265,7 +270,7 @@ func (a *execArtifact) cure(c *CureContext, hostNet bool) (err error) {
}
var count int
- errs := make([]error, 0, len(paths))
+ errs := make([]error, 0, artifactCount)
for cr := range res {
count++
@@ -275,7 +280,7 @@ func (a *execArtifact) cure(c *CureContext, hostNet bool) (err error) {
paths[cr.index[0]].src[cr.index[1]] = cr.pathname
}
- if count == len(paths) {
+ if count == artifactCount {
break
}
}