Skip to content

Commit dfce4ff

Browse files
committed
Vendor and remove from internal JSON packages
The jsonparser and jsonpretty packages were placed in bson/internal. There were not changes necessary to jsonpretty and the only change to jsonparser can be implemented in the bson package using a closure. This commit moves the libraries to the vendor directory, uses the fully copy of the library, and updates the necessary code. GODRIVER-480 GODRIVER-481 Change-Id: I5594ab0e753b27a4a18d959ec047341d988d3876
1 parent 7e09273 commit dfce4ff

22 files changed

+899
-2403
lines changed

THIRD-PARTY-NOTICES

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,32 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
6060
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
6161
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
6262

63+
----------------------------------------------------------------------
64+
License notice for github.com/buger/jsonparser
65+
----------------------------------------------------------------------
66+
67+
MIT License
68+
69+
Copyright (c) 2016 Leonid Bugaev
70+
71+
Permission is hereby granted, free of charge, to any person obtaining a copy
72+
of this software and associated documentation files (the "Software"), to deal
73+
in the Software without restriction, including without limitation the rights
74+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
75+
copies of the Software, and to permit persons to whom the Software is
76+
furnished to do so, subject to the following conditions:
77+
78+
The above copyright notice and this permission notice shall be included in all
79+
copies or substantial portions of the Software.
80+
81+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
82+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
83+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
84+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
85+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
86+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
87+
SOFTWARE.
88+
6389
----------------------------------------------------------------------
6490
License notice for github.com/davecgh/go-spew
6591
----------------------------------------------------------------------
@@ -279,6 +305,31 @@ DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
279305
OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
280306
OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
281307

308+
----------------------------------------------------------------------
309+
License notice for github.com/tidwall/pretty
310+
----------------------------------------------------------------------
311+
312+
The MIT License (MIT)
313+
314+
Copyright (c) 2017 Josh Baker
315+
316+
Permission is hereby granted, free of charge, to any person obtaining a copy of
317+
this software and associated documentation files (the "Software"), to deal in
318+
the Software without restriction, including without limitation the rights to
319+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
320+
the Software, and to permit persons to whom the Software is furnished to do so,
321+
subject to the following conditions:
322+
323+
The above copyright notice and this permission notice shall be included in all
324+
copies or substantial portions of the Software.
325+
326+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
327+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
328+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
329+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
330+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
331+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
332+
282333
----------------------------------------------------------------------
283334
License notice for golang.org/x/crypto
284335
----------------------------------------------------------------------

bson/extjson_bson_corpus_spec_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ import (
1717
"testing"
1818
"unicode"
1919

20-
"github.com/mongodb/mongo-go-driver/bson/internal/jsonpretty"
2120
"github.com/stretchr/testify/require"
21+
"github.com/tidwall/pretty"
2222
)
2323

2424
type testCase struct {

bson/extjson_builder.go

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ import (
1111
"fmt"
1212
"strconv"
1313

14+
"github.com/buger/jsonparser"
1415
"github.com/mongodb/mongo-go-driver/bson/builder"
15-
"github.com/mongodb/mongo-go-driver/bson/internal/jsonparser"
1616
)
1717

1818
type docElementParser func([]byte, []byte, jsonparser.ValueType, int) error
19-
type arrayElementParser func(int, []byte, jsonparser.ValueType, int) error
19+
type arrayElementParser func([]byte, jsonparser.ValueType, int, error)
2020

2121
// ParseExtJSONObject parses a JSON object string into a *Document.
2222
func ParseExtJSONObject(s string) (*Document, error) {
@@ -180,9 +180,11 @@ func parseDocElement(b *builder.DocumentBuilder, ext bool) docElementParser {
180180
}
181181

182182
func parseArrayElement(b *builder.ArrayBuilder, ext bool) arrayElementParser {
183-
return func(index int, value []byte, dataType jsonparser.ValueType, offset int) error {
184-
name := strconv.FormatInt(int64(index), 10)
183+
var index int64
184+
return func(value []byte, dataType jsonparser.ValueType, offset int, _ error) {
185+
name := strconv.FormatInt(index, 10)
186+
index++
185187

186-
return parseDocElement(&b.DocumentBuilder, ext)([]byte(name), value, dataType, offset)
188+
_ = parseDocElement(&b.DocumentBuilder, ext)([]byte(name), value, dataType, offset)
187189
}
188190
}

bson/extjson_parse.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ import (
1010
"errors"
1111
"fmt"
1212

13+
"github.com/buger/jsonparser"
1314
"github.com/mongodb/mongo-go-driver/bson/builder"
14-
"github.com/mongodb/mongo-go-driver/bson/internal/jsonparser"
1515
)
1616

1717
type parseState struct {

bson/extjson_wrappers.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ import (
1414
"strconv"
1515
"time"
1616

17+
"github.com/buger/jsonparser"
1718
"github.com/mongodb/mongo-go-driver/bson/builder"
1819
"github.com/mongodb/mongo-go-driver/bson/decimal"
19-
"github.com/mongodb/mongo-go-driver/bson/internal/jsonparser"
2020
)
2121

2222
type wrapperType byte

bson/internal/jsonparser/bytes_test.go

Lines changed: 0 additions & 101 deletions
This file was deleted.

0 commit comments

Comments
 (0)