From 90648d22cda427612025466ce7dc73363aab2f03 Mon Sep 17 00:00:00 2001 From: slene Date: Thu, 22 Aug 2013 14:54:02 +0800 Subject: [PATCH] avoid panic when len(log) == 0 in colorLog func --- util.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/util.go b/util.go index 2846b97..6cafb46 100644 --- a/util.go +++ b/util.go @@ -50,6 +50,10 @@ const ( // Errors have to surrounded by "[ " and " ]"(space). func colorLog(format string, a ...interface{}) { log := fmt.Sprintf(format, a...) + if len(log) == 0 { + return + } + if runtime.GOOS != "windows" { var clog string