Skip to content

Commit

Permalink
Migrate to go.elastic.co/fastjson
Browse files Browse the repository at this point in the history
- Remove internal/fastjson
- Use go.elastic.co/fastjson
  • Loading branch information
axw committed Oct 25, 2018
1 parent bf46820 commit 1db0d34
Show file tree
Hide file tree
Showing 15 changed files with 260 additions and 819 deletions.
14 changes: 10 additions & 4 deletions gofuzz.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ import (
"github.com/santhosh-tekuri/jsonschema"

"go.elastic.co/apm/internal/apmschema"
"go.elastic.co/apm/internal/fastjson"
"go.elastic.co/apm/model"
"go.elastic.co/apm/stacktrace"
"go.elastic.co/fastjson"
)

func Fuzz(data []byte) int {
Expand Down Expand Up @@ -224,21 +224,27 @@ type gofuzzTransport struct {

func (t *gofuzzTransport) SendErrors(ctx context.Context, payload *model.ErrorsPayload) error {
t.writer.Reset()
payload.MarshalFastJSON(&t.writer)
if err := payload.MarshalFastJSON(&t.writer); err != nil {
return err
}
t.validate(apmschema.Errors)
return nil
}

func (t *gofuzzTransport) SendMetrics(ctx context.Context, payload *model.MetricsPayload) error {
t.writer.Reset()
payload.MarshalFastJSON(&t.writer)
if err := payload.MarshalFastJSON(&t.writer); err != nil {
return err
}
t.validate(apmschema.Metrics)
return nil
}

func (t *gofuzzTransport) SendTransactions(ctx context.Context, payload *model.TransactionsPayload) error {
t.writer.Reset()
payload.MarshalFastJSON(&t.writer)
if err := payload.MarshalFastJSON(&t.writer); err != nil {
return err
}
t.validate(apmschema.Transactions)
return nil
}
Expand Down
7 changes: 4 additions & 3 deletions internal/apmhttputil/url_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import (
"github.com/stretchr/testify/assert"

"go.elastic.co/apm/internal/apmhttputil"
"go.elastic.co/apm/internal/fastjson"
"go.elastic.co/apm/model"
"go.elastic.co/fastjson"
)

func TestRequestURLClient(t *testing.T) {
Expand Down Expand Up @@ -97,12 +97,13 @@ func TestRequestURLHeaders(t *testing.T) {

// Marshal the URL to gets its "full" representation.
var w fastjson.Writer
out.MarshalFastJSON(&w)
err := out.MarshalFastJSON(&w)
assert.NoError(t, err)

var decoded struct {
Full string
}
err := json.Unmarshal(w.Bytes(), &decoded)
err = json.Unmarshal(w.Bytes(), &decoded)
assert.NoError(t, err)
assert.Equal(t, test.full, decoded.Full)
})
Expand Down
7 changes: 0 additions & 7 deletions internal/fastjson/LICENSE.easyjson.txt

This file was deleted.

10 changes: 0 additions & 10 deletions internal/fastjson/doc.go

This file was deleted.

Loading

0 comments on commit 1db0d34

Please sign in to comment.