From 76663079312bb501f545823d9650df9eeda2c882 Mon Sep 17 00:00:00 2001 From: Solomon Hykes <solomon@dotcloud.com> Date: Tue, 2 Apr 2013 10:58:16 -0700 Subject: [PATCH] Use an environment variable to activate debug mode, instead of a package-specific flag --- docker/docker.go | 4 +++- utils.go | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/docker/docker.go b/docker/docker.go index 71566539d8..b86f110bd6 100644 --- a/docker/docker.go +++ b/docker/docker.go @@ -21,7 +21,9 @@ func main() { flDaemon := flag.Bool("d", false, "Daemon mode") flDebug := flag.Bool("D", false, "Debug mode") flag.Parse() - rcli.DEBUG_FLAG = *flDebug + if *flDebug { + os.Setenv("DEBUG", "1") + } if *flDaemon { if flag.NArg() != 0 { flag.Usage() diff --git a/utils.go b/utils.go index 381af1fe38..dcd224adc5 100644 --- a/utils.go +++ b/utils.go @@ -45,7 +45,7 @@ func Download(url string, stderr io.Writer) (*http.Response, error) { // Debug function, if the debug flag is set, then display. Do nothing otherwise // If Docker is in damon mode, also send the debug info on the socket func Debugf(format string, a ...interface{}) { - if rcli.DEBUG_FLAG { + if os.Getenv("DEBUG") != "" { // Retrieve the stack infos _, file, line, ok := runtime.Caller(1)