From 9f58baa7a613f89dfdc764c39e47fd3a15606153 Mon Sep 17 00:00:00 2001 From: tidwall Date: Wed, 23 Dec 2020 05:00:23 -0700 Subject: [PATCH] Update the match package This commit updates the match package to v1.0.3, which includes a fix to an issue where a pattern with lots of repetitive stars will increasingly slow down a Match operation. Fixes #195 --- gjson_test.go | 8 ++++++-- go.mod | 2 +- go.sum | 2 ++ 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/gjson_test.go b/gjson_test.go index 414f3f6..c7966a5 100644 --- a/gjson_test.go +++ b/gjson_test.go @@ -2180,7 +2180,6 @@ func TestJoin152(t *testing.T) { } func TestIssue192(t *testing.T) { - assert(t, squash(`"000"hello`) == `"000"`) assert(t, squash(`"000"`) == `"000"`) assert(t, squash(`"000`) == `"000`) @@ -2194,5 +2193,10 @@ func TestIssue192(t *testing.T) { testJSON := `0.#[[{}]].@valid:"000` Get(testJSON, testJSON) - +} + +func TestIssue195(t *testing.T) { + testJSON := `\************************************` + + `**********{**",**,,**,**,**,**,"",**,**,**,**,**,**,**,**,**,**]` + Get(testJSON, testJSON) } diff --git a/go.mod b/go.mod index c287095..30d1804 100644 --- a/go.mod +++ b/go.mod @@ -3,6 +3,6 @@ module github.com/tidwall/gjson go 1.12 require ( - github.com/tidwall/match v1.0.1 + github.com/tidwall/match v1.0.3 github.com/tidwall/pretty v1.0.2 ) diff --git a/go.sum b/go.sum index 75e1dd7..1eb2014 100644 --- a/go.sum +++ b/go.sum @@ -1,4 +1,6 @@ github.com/tidwall/match v1.0.1 h1:PnKP62LPNxHKTwvHHZZzdOAOCtsJTjo6dZLCwpKm5xc= github.com/tidwall/match v1.0.1/go.mod h1:LujAq0jyVjBy028G1WhWfIzbpQfMO8bBZ6Tyb0+pL9E= +github.com/tidwall/match v1.0.3 h1:FQUVvBImDutD8wJLN6c5eMzWtjgONK9MwIBCOrUJKeE= +github.com/tidwall/match v1.0.3/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM= github.com/tidwall/pretty v1.0.2 h1:Z7S3cePv9Jwm1KwS0513MRaoUe3S01WPbLNV40pwWZU= github.com/tidwall/pretty v1.0.2/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk=