summaryrefslogtreecommitdiffstats
path: root/deps
diff options
context:
space:
mode:
Diffstat (limited to 'deps')
-rw-r--r--deps/deps.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/deps/deps.go b/deps/deps.go
index 7b252d020..511ee885c 100644
--- a/deps/deps.go
+++ b/deps/deps.go
@@ -119,6 +119,8 @@ type Deps struct {
type globalErrHandler struct {
// Channel for some "hard to get to" build errors
buildErrors chan error
+ // Used to signal that the build is done.
+ quit chan struct{}
}
// SendErr sends the error on a channel to be handled later.
@@ -127,6 +129,7 @@ type globalErrHandler struct {
func (e *globalErrHandler) SendError(err error) {
if e.buildErrors != nil {
select {
+ case <-e.quit:
case e.buildErrors <- err:
default:
}
@@ -137,10 +140,18 @@ func (e *globalErrHandler) SendError(err error) {
}
func (e *globalErrHandler) StartErrorCollector() chan error {
+ e.quit = make(chan struct{})
e.buildErrors = make(chan error, 10)
return e.buildErrors
}
+func (e *globalErrHandler) StopErrorCollector() {
+ if e.buildErrors != nil {
+ close(e.quit)
+ close(e.buildErrors)
+ }
+}
+
// Listeners represents an event listener.
type Listeners struct {
sync.Mutex