Run of fresh-snapshots for golang-github-buger-jsonparser

Try this locally (using silver-platter):

debian-svp new-upstream --snapshot golang-github-buger-jsonparser 

Merge these changes:

Summary

Merged new upstream version: 1.1.1+git20210402.1.a0c6c18 (was: 1.1.1).

Diff

Branch: main

diff --git a/.travis.yml b/.travis.yml
index dbfb7cf..46efadc 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -3,9 +3,7 @@ arch:
     - amd64
     - ppc64le
 go:
-    - 1.7.x
-    - 1.8.x
-    - 1.9.x
-    - 1.10.x
-    - 1.11.x
+    - 1.13.x
+    - 1.14.x
+    - 1.15.x
 script: go test -v ./.
diff --git a/debian/changelog b/debian/changelog
index 9870651..dc87043 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+golang-github-buger-jsonparser (1.1.1+git20210402.1.a0c6c18-1) UNRELEASED; urgency=low
+
+  * New upstream snapshot.
+
+ -- Debian Janitor <janitor@jelmer.uk>  Fri, 09 Apr 2021 11:07:22 -0000
+
 golang-github-buger-jsonparser (1.1.1-1) unstable; urgency=medium
 
   * New upstream release.
diff --git a/parser.go b/parser.go
index 14b80bc..ff3b577 100644
--- a/parser.go
+++ b/parser.go
@@ -49,10 +49,13 @@ func findTokenStart(data []byte, token byte) int {
 }
 
 func findKeyStart(data []byte, key string) (int, error) {
-	i := 0
+	i := nextToken(data)
+	if i == -1 {
+		return i, KeyPathNotFoundError
+	}
 	ln := len(data)
-	if ln > 0 && (data[0] == '{' || data[0] == '[') {
-		i = 1
+	if ln > 0 && (data[i] == '{' || data[i] == '[') {
+		i += 1
 	}
 	var stackbuf [unescapeStackBufSize]byte // stack-allocated array for allocation-free unescaping of small strings
 
@@ -374,12 +377,19 @@ func sameTree(p1, p2 []string) bool {
 	return true
 }
 
+const stackArraySize = 128
+
 func EachKey(data []byte, cb func(int, []byte, ValueType, error), paths ...[]string) int {
 	var x struct{}
-	pathFlags := make([]bool, len(paths))
 	var level, pathsMatched, i int
 	ln := len(data)
 
+	pathFlags := make([]bool, stackArraySize)[:]
+	if len(paths) > cap(pathFlags) {
+		pathFlags = make([]bool, len(paths))[:]
+	}
+	pathFlags = pathFlags[0:len(paths)]
+
 	var maxPath int
 	for _, p := range paths {
 		if len(p) > maxPath {
@@ -387,7 +397,11 @@ func EachKey(data []byte, cb func(int, []byte, ValueType, error), paths ...[]str
 		}
 	}
 
-	pathsBuf := make([]string, maxPath)
+	pathsBuf := make([]string, stackArraySize)[:]
+	if maxPath > cap(pathsBuf) {
+		pathsBuf = make([]string, maxPath)[:]
+	}
+	pathsBuf = pathsBuf[0:maxPath]
 
 	for i < ln {
 		switch data[i] {
@@ -662,7 +676,6 @@ func calcAllocateSpace(keys []string, setValue []byte, comma, object bool) int {
 		}
 	}
 
-
 	lk += len(setValue)
 	for i := 1; i < len(keys); i++ {
 		if string(keys[i][0]) == "[" {
diff --git a/parser_test.go b/parser_test.go
index 11b3e66..56044e9 100644
--- a/parser_test.go
+++ b/parser_test.go
@@ -221,6 +221,12 @@ var deleteTests = []DeleteTest{
 		path: []string{""},
 		data: `^_�^C^A^@{`,
 	},
+	{
+		desc: "Issue #150: leading space",
+		json: `   {"test":"input"}`,
+		path: []string{"test"},
+		data: `   {}`,
+	},
 }
 
 var setTests = []SetTest{
@@ -989,15 +995,15 @@ var getStringTests = []GetTest{
 		isErr: true,
 	},
 	{
-		desc:  `empty array index`,
-		json:  `[""]`,
-		path:  []string{"[]"},
+		desc:    `empty array index`,
+		json:    `[""]`,
+		path:    []string{"[]"},
 		isFound: false,
 	},
 	{
-		desc:  `malformed array index`,
-		json:  `[""]`,
-		path:  []string{"["},
+		desc:    `malformed array index`,
+		json:    `[""]`,
+		path:    []string{"["},
 		isFound: false,
 	},
 }

Branch: pristine-tar

diff --git a/golang-github-buger-jsonparser_1.1.1+git20210402.1.a0c6c18.orig.tar.gz.delta b/golang-github-buger-jsonparser_1.1.1+git20210402.1.a0c6c18.orig.tar.gz.delta
new file mode 100644
index 0000000..ff47a06
Binary files /dev/null and b/golang-github-buger-jsonparser_1.1.1+git20210402.1.a0c6c18.orig.tar.gz.delta differ
diff --git a/golang-github-buger-jsonparser_1.1.1+git20210402.1.a0c6c18.orig.tar.gz.id b/golang-github-buger-jsonparser_1.1.1+git20210402.1.a0c6c18.orig.tar.gz.id
new file mode 100644
index 0000000..9526915
--- /dev/null
+++ b/golang-github-buger-jsonparser_1.1.1+git20210402.1.a0c6c18.orig.tar.gz.id
@@ -0,0 +1 @@
+5f7d4a02c2cd23ca85cfb2882362efc2d0df2692

Branch: upstream

Tag: upstream/1.1.1+git20210402.1.a0c6c18

Diff is too long (more than 200 lines). Download the raw diff.

Debdiff

File lists identical (after any substitutions)

No differences were encountered in the control files

Resulting package

The resulting binary packages can be installed (if you have the apt repository enabled) by running one of:

apt install -t fresh-snapshots golang-github-buger-jsonparser-dev

Lintian Result

Full worker log Full build log Full dist log