Skip to content

Commit 8a2bb98

Browse files
committed
change module name to github.com/bytedance/sonic
1 parent 9872089 commit 8a2bb98

File tree

103 files changed

+177
-167
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

103 files changed

+177
-167
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
PKG := github.com/goccy/go-json
1+
PKG := github.com/bytedance/sonic
22

33
BIN_DIR := $(CURDIR)/bin
44
PKGS := $(shell go list ./... | grep -v internal/cmd|grep -v test)

README.md

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,18 @@
1+
# Fork for replacing github.com/bytedance/sonic
2+
3+
This is a fork of `github.com/goccy/go-json` with just the module name changed to `github.com/bytedance/sonic`. This is to provide
4+
an easy way to remove the actual `github.com/bytedance/sonic` in the dependency tree in any project.
5+
6+
Add the following replace directive:
7+
8+
```
9+
replace github.com/bytedance/sonic => github.com/cordialsys/go-json v0.10.5-sonic-replace
10+
```
11+
112
# go-json
213

3-
![Go](https://github.com/goccy/go-json/workflows/Go/badge.svg)
4-
[![GoDoc](https://godoc.org/github.com/goccy/go-json?status.svg)](https://pkg.go.dev/github.com/goccy/go-json?tab=doc)
14+
![Go](https://github.com/bytedance/sonic/workflows/Go/badge.svg)
15+
[![GoDoc](https://godoc.org/github.com/bytedance/sonic?status.svg)](https://pkg.go.dev/github.com/bytedance/sonic?tab=doc)
516
[![codecov](https://codecov.io/gh/goccy/go-json/branch/master/graph/badge.svg)](https://codecov.io/gh/goccy/go-json)
617

718
Fast JSON encoder/decoder compatible with encoding/json for Go
@@ -22,12 +33,12 @@ Fast JSON encoder/decoder compatible with encoding/json for Go
2233
```
2334

2435
We are accepting requests for features that will be implemented between v0.9.0 and v.1.0.0.
25-
If you have the API you need, please submit your issue [here](https://github.com/goccy/go-json/issues).
36+
If you have the API you need, please submit your issue [here](https://github.com/bytedance/sonic/issues).
2637

2738
# Features
2839

2940
- Drop-in replacement of `encoding/json`
30-
- Fast ( See [Benchmark section](https://github.com/goccy/go-json#benchmarks) )
41+
- Fast ( See [Benchmark section](https://github.com/bytedance/sonic#benchmarks) )
3142
- Flexible customization with options
3243
- Coloring the encoded string
3344
- Can propagate context.Context to `MarshalJSON` or `UnmarshalJSON`
@@ -36,16 +47,16 @@ If you have the API you need, please submit your issue [here](https://github.com
3647
# Installation
3748

3849
```
39-
go get github.com/goccy/go-json
50+
go get github.com/bytedance/sonic
4051
```
4152

4253
# How to use
4354

44-
Replace import statement from `encoding/json` to `github.com/goccy/go-json`
55+
Replace import statement from `encoding/json` to `github.com/bytedance/sonic`
4556

4657
```
4758
-import "encoding/json"
48-
+import "github.com/goccy/go-json"
59+
+import "github.com/bytedance/sonic"
4960
```
5061

5162
# JSON library comparison
@@ -98,8 +109,8 @@ $ go test -bench .
98109

99110
# Fuzzing
100111

101-
[go-json-fuzz](https://github.com/goccy/go-json-fuzz) is the repository for fuzzing tests.
102-
If you run the test in this repository and find a bug, please commit to corpus to go-json-fuzz and report the issue to [go-json](https://github.com/goccy/go-json/issues).
112+
[go-json-fuzz](https://github.com/bytedance/sonic-fuzz) is the repository for fuzzing tests.
113+
If you run the test in this repository and find a bug, please commit to corpus to go-json-fuzz and report the issue to [go-json](https://github.com/bytedance/sonic/issues).
103114

104115
# How it works
105116

@@ -192,7 +203,7 @@ For this reason, to date `reflect.Type` is the same as `*reflect.rtype`.
192203

193204
Therefore, by directly handling `*reflect.rtype`, which is an implementation of `reflect.Type`, it is possible to avoid escaping because it changes from `interface` to using `struct`.
194205

195-
The technique for working with `*reflect.rtype` directly from `go-json` is implemented at [rtype.go](https://github.com/goccy/go-json/blob/master/internal/runtime/rtype.go)
206+
The technique for working with `*reflect.rtype` directly from `go-json` is implemented at [rtype.go](https://github.com/bytedance/sonic/blob/master/internal/runtime/rtype.go)
196207

197208
Also, the same technique is cut out as a library ( https://github.com/goccy/go-reflect )
198209

@@ -353,7 +364,7 @@ However, if there is too much type information, it will use a lot of memory, so
353364

354365
If this approach is not available, it will fall back to the `atomic` based process described above.
355366

356-
If you want to know more, please refer to the implementation [here](https://github.com/goccy/go-json/blob/master/internal/runtime/type.go#L36-L100)
367+
If you want to know more, please refer to the implementation [here](https://github.com/bytedance/sonic/blob/master/internal/runtime/type.go#L36-L100)
357368

358369
## Decoder
359370

benchmarks/bench_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import (
2121

2222
stdjson "encoding/json"
2323

24-
"github.com/goccy/go-json"
24+
"github.com/bytedance/sonic"
2525
jsoniter "github.com/json-iterator/go"
2626
segmentiojson "github.com/segmentio/encoding/json"
2727
"github.com/wI2L/jettison"

benchmarks/decode_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"testing"
77

88
gojay "github.com/francoispqt/gojay"
9-
gojson "github.com/goccy/go-json"
9+
gojson "github.com/bytedance/sonic"
1010
jsoniter "github.com/json-iterator/go"
1111
segmentiojson "github.com/segmentio/encoding/json"
1212
fastjson "github.com/valyala/fastjson"

benchmarks/encode_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77
"testing"
88

99
gojay "github.com/francoispqt/gojay"
10-
gojson "github.com/goccy/go-json"
10+
gojson "github.com/bytedance/sonic"
1111
jsoniter "github.com/json-iterator/go"
1212
"github.com/pquerna/ffjson/ffjson"
1313
segmentiojson "github.com/segmentio/encoding/json"

benchmarks/go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ go 1.19
44

55
require (
66
github.com/francoispqt/gojay v1.2.13
7-
github.com/goccy/go-json v0.0.0-00010101000000-000000000000
7+
github.com/bytedance/sonic v0.0.0-00010101000000-000000000000
88
github.com/json-iterator/go v1.1.10
99
github.com/mailru/easyjson v0.0.0-20190312143242-1de009706dbe
1010
github.com/pquerna/ffjson v0.0.0-20190930134022-aa0246cd15f7
@@ -19,4 +19,4 @@ require (
1919
github.com/stretchr/testify v1.7.0 // indirect
2020
)
2121

22-
replace github.com/goccy/go-json => ../
22+
replace github.com/bytedance/sonic => ../

benchmarks/path_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package benchmark
33
import (
44
"testing"
55

6-
gojson "github.com/goccy/go-json"
6+
gojson "github.com/bytedance/sonic"
77
)
88

99
func Benchmark_Decode_SmallStruct_UnmarshalPath_GoJson(b *testing.B) {

benchmarks/slow_reader_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77
"reflect"
88
"testing"
99

10-
gojson "github.com/goccy/go-json"
10+
gojson "github.com/bytedance/sonic"
1111
)
1212

1313
// Benchmark decoding from a slow io.Reader that never fills the buffer completely

color.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
package json
1+
package sonic
22

33
import (
44
"fmt"
55

6-
"github.com/goccy/go-json/internal/encoder"
6+
"github.com/bytedance/sonic/internal/encoder"
77
)
88

99
type (

color_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
package json_test
1+
package sonic_test
22

33
import (
44
"testing"
55

6-
"github.com/goccy/go-json"
6+
json "github.com/bytedance/sonic"
77
)
88

99
func TestColorize(t *testing.T) {

0 commit comments

Comments
 (0)