Skip to content

Commit 25accc1

Browse files
committed
close the channel properly
1 parent 600661a commit 25accc1

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

tools/amplify-preview/amplify.go

+6-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"errors"
66
"fmt"
77
"strings"
8+
"sync"
89
"time"
910

1011
"github.com/aws/aws-sdk-go-v2/service/amplify"
@@ -43,6 +44,8 @@ func (amp *AmplifyPreview) FindExistingBranch(ctx context.Context, branchName st
4344
data *amplify.GetBranchOutput
4445
err error
4546
}
47+
var wg sync.WaitGroup
48+
wg.Add(len(amp.appIDs))
4649
resultCh := make(chan resp, len(amp.appIDs))
4750

4851
for _, appID := range amp.appIDs {
@@ -56,10 +59,12 @@ func (amp *AmplifyPreview) FindExistingBranch(ctx context.Context, branchName st
5659
data: branch,
5760
err: err,
5861
}
59-
6062
}()
6163
}
6264

65+
wg.Wait()
66+
close(resultCh)
67+
6368
failedResp := aggregatedError{
6469
perAppErr: map[string]error{},
6570
message: "failed to fetch branch",

0 commit comments

Comments
 (0)