From 883ab41ce8f5163ba8ce0450ffff1e63c266f23b Mon Sep 17 00:00:00 2001 From: Joyce Date: Mon, 16 Oct 2017 14:42:37 -0700 Subject: [PATCH] fix todo for printing error messages Signed-off-by: Joyce --- builder/remotecontext/git.go | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/builder/remotecontext/git.go b/builder/remotecontext/git.go index 158bb5ad4d..f6fc0bc3fb 100644 --- a/builder/remotecontext/git.go +++ b/builder/remotecontext/git.go @@ -6,6 +6,7 @@ import ( "github.com/docker/docker/builder" "github.com/docker/docker/builder/remotecontext/git" "github.com/docker/docker/pkg/archive" + "github.com/sirupsen/logrus" ) // MakeGitContext returns a Context from gitURL that is cloned in a temporary directory. @@ -21,9 +22,14 @@ func MakeGitContext(gitURL string) (builder.Source, error) { } defer func() { - // TODO: print errors? - c.Close() - os.RemoveAll(root) + err := c.Close() + if err != nil { + logrus.WithField("action", "MakeGitContext").WithField("module", "builder").WithField("url", gitURL).WithError(err).Error("error while closing git context") + } + err = os.RemoveAll(root) + if err != nil { + logrus.WithField("action", "MakeGitContext").WithField("module", "builder").WithField("url", gitURL).WithError(err).Error("error while removing path and children of root") + } }() return FromArchive(c) }