Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "3.1.1"
".": "4.0.0"
}
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# LaunchDarkly Streaming JSON for Go

[![Actions Status](https://github.com/launchdarkly/go-jsonstream/actions/workflows/ci.yml/badge.svg?branch=v3)](https://github.com/launchdarkly/go-jsonstream/actions/workflows/ci.yml)
[![Go Reference](https://pkg.go.dev/badge/github.com/launchdarkly/go-jsonstream/v3.svg)](https://pkg.go.dev/github.com/launchdarkly/go-jsonstream/v3)
[![Actions Status](https://github.com/launchdarkly/go-jsonstream/actions/workflows/ci.yml/badge.svg?branch=v4)](https://github.com/launchdarkly/go-jsonstream/actions/workflows/ci.yml)
[![Go Reference](https://pkg.go.dev/badge/github.com/launchdarkly/go-jsonstream/v4.svg)](https://pkg.go.dev/github.com/launchdarkly/go-jsonstream/v4)

## Overview

Expand Down
8 changes: 2 additions & 6 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
module github.com/launchdarkly/go-jsonstream/v3
module github.com/launchdarkly/go-jsonstream/v4

go 1.24

require (
github.com/mailru/easyjson v0.7.6
github.com/stretchr/testify v1.6.1
)
require github.com/stretchr/testify v1.6.1

require (
github.com/davecgh/go-spew v1.1.0 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
4 changes: 0 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY=
github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y=
github.com/mailru/easyjson v0.7.6 h1:8yTIVnZgCoiM1TgqoeTl+LfU5Jg6/xL3QhGQnimLYnA=
github.com/mailru/easyjson v0.7.6/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
Expand Down
4 changes: 2 additions & 2 deletions jreader/json_unmarshal_comparative_benchmark_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import (
"encoding/json"
"testing"

"github.com/launchdarkly/go-jsonstream/v3/internal/commontest"
"github.com/launchdarkly/go-jsonstream/v4/internal/commontest"
)

// These benchmarks perform equivalent actions to the ones in reader_benchmark_test.go, but using
// the default reflection-based mechanism from the json/encoding package, so we can see how much
// less efficient that is than our default implementation and the easyjson implementation.
// less efficient that is than our default implementation.

func BenchmarkJSONUnmarshalComparatives(b *testing.B) {
b.Run("Null", benchmarkReadNullJSONUnmarshal)
Expand Down
21 changes: 0 additions & 21 deletions jreader/package_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,25 +26,4 @@
// s.ReadFromJSONReader(&r)
// fmt.Printf("%+v\n", s)
// }
//
// The underlying low-level token parsing mechanism has two available implementations. The default
// implementation has no external dependencies. For interoperability with the easyjson library
// (https://github.com/mailru/easyjson), there is also an implementation that delegates to the
// easyjson streaming parser; this is enabled by setting the build tag "launchdarkly_easyjson".
// Be aware that by default, easyjson uses Go's "unsafe" package (https://pkg.go.dev/unsafe),
// which may not be available on all platforms.
//
// Setting the "launchdarkly_easyjson" tag also adds a new constructor function,
// NewReaderFromEasyJSONLexer, allowing Reader-based code to read directly from an existing
// EasyJSON jlexer.Lexer. This may be desirable in order to define common unmarshaling logic that
// may be used with or without EasyJSON. For example:
//
// import (
// "github.com/mailru/easyjson/jlexer"
// )
//
// func (s *myStruct) UnmarshalEasyJSON(lexer *jlexer.Lexer) {
// r := jreader.NewReaderFromEasyJSONLexer(lexer)
// s.ReadFromJSONReader(&r)
// }
package jreader
2 changes: 1 addition & 1 deletion jreader/reader_benchmark_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package jreader
import (
"testing"

"github.com/launchdarkly/go-jsonstream/v3/internal/commontest"
"github.com/launchdarkly/go-jsonstream/v4/internal/commontest"
)

func BenchmarkReadNullNoAlloc(b *testing.B) {
Expand Down
3 changes: 0 additions & 3 deletions jreader/reader_default.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
//go:build !launchdarkly_easyjson
// +build !launchdarkly_easyjson

package jreader

// String attempts to read a string value.
Expand Down
31 changes: 0 additions & 31 deletions jreader/reader_easyjson.go

This file was deleted.

22 changes: 0 additions & 22 deletions jreader/reader_init_easyjson.go

This file was deleted.

45 changes: 0 additions & 45 deletions jreader/reader_init_easyjson_test.go

This file was deleted.

6 changes: 1 addition & 5 deletions jreader/reader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"fmt"
"testing"

"github.com/launchdarkly/go-jsonstream/v3/internal/commontest"
"github.com/launchdarkly/go-jsonstream/v4/internal/commontest"

"github.com/stretchr/testify/require"
)
Expand Down Expand Up @@ -417,10 +417,6 @@ func TestReaderSkipValue(t *testing.T) {

func TestReaderSkipValueAllocations(t *testing.T) {
expectedAllocs := 0
if isEasyJSON {
// easyjson doesn't easily let us aggressively optimize out allocations.
expectedAllocs = 4
}

data := []byte(`{"a":1, "b":{"b1":"two", "b2":"three"}, "c":4}`)

Expand Down
2 changes: 1 addition & 1 deletion jreader/reader_unmarshal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package jreader
import (
"testing"

"github.com/launchdarkly/go-jsonstream/v3/internal/commontest"
"github.com/launchdarkly/go-jsonstream/v4/internal/commontest"

"github.com/stretchr/testify/require"
)
Expand Down
2 changes: 1 addition & 1 deletion jreader/testdata_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package jreader

import (
"github.com/launchdarkly/go-jsonstream/v3/internal/commontest"
"github.com/launchdarkly/go-jsonstream/v4/internal/commontest"
)

// ExampleStruct is defined in another package, so we need to wrap it in our own type to define methods on it.
Expand Down
10 changes: 2 additions & 8 deletions jreader/token_reader_default.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
//go:build !launchdarkly_easyjson
// +build !launchdarkly_easyjson

package jreader

// This file defines the default implementation of the low-level JSON tokenizer. If the launchdarkly_easyjson
// build tag is enabled, we use the easyjson adapter in token_reader_easyjson.go instead. These have the same
// methods so the Reader code does not need to know which implementation we're using; however, we don't
// actually define an interface for these, because calling the methods through an interface would limit
// performance.
// This file defines the low-level JSON tokenizer. We don't define an interface for these methods,
// because calling them through an interface would limit performance.

import (
"bytes"
Expand Down
7 changes: 0 additions & 7 deletions jreader/token_reader_default_test.go
Original file line number Diff line number Diff line change
@@ -1,8 +1 @@
//go:build !launchdarkly_easyjson
// +build !launchdarkly_easyjson

package jreader

// isEasyJSON is used in tests to e.g. expect different allocation behavior depending
// on which backend is in use.
const isEasyJSON = false
Loading
Loading