From 5a5809bd950c8d7cf76058ecbf1095755e66eac8 Mon Sep 17 00:00:00 2001 From: ClownFish Date: Fri, 8 Oct 2021 16:17:58 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dgini=E7=9A=84bug=E3=80=82?= =?UTF-8?q?=20=E5=BD=93ini=E7=9A=84=E9=85=8D=E7=BD=AE=E5=80=BC=E4=B8=AD?= =?UTF-8?q?=E5=90=AB=E6=9C=89"=3D"=E6=97=B6=E5=80=99=EF=BC=8C=E4=B8=8D?= =?UTF-8?q?=E8=83=BD=E6=AD=A3=E7=A1=AE=E8=A7=A3=E6=9E=90=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- encoding/gini/gini.go | 2 +- encoding/gini/gini_test.go | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/encoding/gini/gini.go b/encoding/gini/gini.go index a0b31f37f..e9bd2c729 100644 --- a/encoding/gini/gini.go +++ b/encoding/gini/gini.go @@ -65,7 +65,7 @@ func Decode(data []byte) (res map[string]interface{}, err error) { if strings.Contains(lineStr, "=") && haveSection { values := strings.Split(lineStr, "=") - fieldMap[strings.TrimSpace(values[0])] = strings.TrimSpace(strings.Join(values[1:], "")) + fieldMap[strings.TrimSpace(values[0])] = strings.TrimSpace(strings.Join(values[1:], "=")) res[section] = fieldMap } } diff --git a/encoding/gini/gini_test.go b/encoding/gini/gini_test.go index e373410b5..f40bec436 100644 --- a/encoding/gini/gini_test.go +++ b/encoding/gini/gini_test.go @@ -22,6 +22,7 @@ aa=bb ip = 127.0.0.1 port=9001 enable=true +command=/bin/echo "gf=GoFrame" [DBINFO] type=mysql @@ -40,6 +41,7 @@ func TestDecode(t *testing.T) { } t.Assert(res["addr"].(map[string]interface{})["ip"], "127.0.0.1") t.Assert(res["addr"].(map[string]interface{})["port"], "9001") + t.Assert(res["addr"].(map[string]interface{})["command"], `/bin/echo "gf=GoFrame"`) t.Assert(res["DBINFO"].(map[string]interface{})["user"], "root") t.Assert(res["DBINFO"].(map[string]interface{})["type"], "mysql") t.Assert(res["键"].(map[string]interface{})["呵呵"], "值") From e0c4f7ccbff32605762614703f6ed94863ef55a3 Mon Sep 17 00:00:00 2001 From: "lindan.he" Date: Sat, 9 Oct 2021 18:32:59 +0800 Subject: [PATCH 2/3] Fixed: #1421 --- os/glog/glog_logger.go | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/os/glog/glog_logger.go b/os/glog/glog_logger.go index b52b860b1..26ceec229 100644 --- a/os/glog/glog_logger.go +++ b/os/glog/glog_logger.go @@ -10,25 +10,24 @@ import ( "bytes" "context" "fmt" - "github.com/fatih/color" - "github.com/gogf/gf/container/gtype" - "github.com/gogf/gf/internal/intlog" - "github.com/gogf/gf/os/gctx" - "github.com/gogf/gf/os/gfpool" - "github.com/gogf/gf/os/gmlock" - "github.com/gogf/gf/os/gtimer" - "go.opentelemetry.io/otel/trace" "io" "os" "strings" "time" + "github.com/fatih/color" + "github.com/gogf/gf/container/gtype" "github.com/gogf/gf/debug/gdebug" - + "github.com/gogf/gf/internal/intlog" + "github.com/gogf/gf/os/gctx" "github.com/gogf/gf/os/gfile" + "github.com/gogf/gf/os/gfpool" + "github.com/gogf/gf/os/gmlock" "github.com/gogf/gf/os/gtime" + "github.com/gogf/gf/os/gtimer" "github.com/gogf/gf/text/gregex" "github.com/gogf/gf/util/gconv" + "go.opentelemetry.io/otel/trace" ) // Logger is the struct for logging management. @@ -204,7 +203,7 @@ func (l *Logger) print(ctx context.Context, level int, values ...interface{}) { if len(input.Content) > 0 { if input.Content[len(input.Content)-1] == '\n' { // Remove one blank line(\n\n). - if tempStr[0] == '\n' { + if len(tempStr) > 0 && tempStr[0] == '\n' { input.Content += tempStr[1:] } else { input.Content += tempStr From 5ffd362b6e8d1cc4522bdb05b5e2186d56d09190 Mon Sep 17 00:00:00 2001 From: danvinhe Date: Wed, 3 Nov 2021 15:02:21 +0800 Subject: [PATCH 3/3] Update glog_logger.go MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 多了个空格 --- os/glog/glog_logger.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/os/glog/glog_logger.go b/os/glog/glog_logger.go index 43edc0206..bdd873976 100644 --- a/os/glog/glog_logger.go +++ b/os/glog/glog_logger.go @@ -22,7 +22,7 @@ import ( "os" "strings" "time" - + "github.com/gogf/gf/v2/debug/gdebug" "github.com/gogf/gf/v2/os/gfile"