Merge pull request #35244 from joyce/joyce/todo-fixes

fix todo for printing error messages
This commit is contained in:
Yong Tang 2017-11-04 13:52:45 -07:00 committed by GitHub
commit 48694a3f88
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 3 deletions

View File

@ -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)
}