From cac5b10a9e6e4d288de45f0a519534b299f572c5 Mon Sep 17 00:00:00 2001 From: Andres Erbsen Date: Wed, 24 Apr 2019 20:44:43 -0400 Subject: [PATCH] Cancel guest settling Context to satisfy go vet According to go vet, this should be done to avoid a context leak. Tested with the hello world example and the archlinux image. Now go vet passes inside worker/. --- worker/tasks.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/worker/tasks.go b/worker/tasks.go index 75d79ec..960071f 100644 --- a/worker/tasks.go +++ b/worker/tasks.go @@ -94,7 +94,8 @@ func (ctx *JobContext) Settle() error { archTimer := prometheus.NewTimer(archSettleTime) defer archTimer.ObserveDuration() - timeout, _ := context.WithTimeout(ctx.Context, 120*time.Second) + timeout, cancel := context.WithTimeout(ctx.Context, 120*time.Second) + defer cancel() done := make(chan error, 1) attempt := 0 go func() { -- 2.38.5