From c56ed598cbe394915636270beb31a7d61b42a851 Mon Sep 17 00:00:00 2001 From: Ta-Ching Chen Date: Wed, 7 Feb 2018 07:14:47 +0800 Subject: [PATCH] Fix potential nil pointer problem when both watchResources and waitForBuild are equal to false (#485) --- fission/spec.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/fission/spec.go b/fission/spec.go index ae6654e6..8ea7dbff 100644 --- a/fission/spec.go +++ b/fission/spec.go @@ -424,14 +424,13 @@ func specApply(c *cli.Context) error { checkErr(err, "apply specs") printApplyStatus(as) - var ctx context.Context - var pkgWatchCancel context.CancelFunc if watchResources || waitForBuild { // watch package builds - ctx, pkgWatchCancel = context.WithCancel(context.Background()) pbw.addPackages(pkgMetas) } + ctx, pkgWatchCancel := context.WithCancel(context.Background()) + if watchResources { // if we're watching for files, we don't need to wait for builds to complete go pbw.watch(ctx)