-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Disable bytedance/sonic on go1.21 (#8)
* internal/json: disable bytedance/sonic on go1.21 * zapcl: move SetEscapeHTML to internal/json * codecov: ignore internal/json coverage --------- Signed-off-by: Koichi Shiraishi <zchee.io@gmail.com>
- Loading branch information
Showing
5 changed files
with
33 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,6 +36,7 @@ coverage: | |
|
||
ignore: | ||
- "caller.go" | ||
- "internal/json" | ||
|
||
comment: | ||
layout: "newheader, diff, flags, files" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// Copyright 2023 The zapcl Authors | ||
// SPDX-License-Identifier: BSD-3-Clause | ||
|
||
//go:build arm64 || (go1.21 && amd64) | ||
// +build arm64 go1.21,amd64 | ||
|
||
package json | ||
|
||
import ( | ||
"io" | ||
|
||
gojson "github.com/goccy/go-json" | ||
"go.uber.org/zap/zapcore" | ||
) | ||
|
||
// NewEncoder returns the github.com/goccy/go-json NewEncoder. | ||
func NewEncoder(w io.Writer) zapcore.ReflectedEncoder { | ||
enc := gojson.NewEncoder(w) | ||
enc.SetEscapeHTML(false) | ||
return enc | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,22 @@ | ||
// Copyright 2023 The zapcl Authors | ||
// SPDX-License-Identifier: BSD-3-Clause | ||
|
||
//go:build !go1.21 && amd64 | ||
// +build !go1.21,amd64 | ||
|
||
package json | ||
|
||
import ( | ||
"io" | ||
|
||
"github.com/bytedance/sonic/encoder" | ||
"github.com/bytedance/sonic" | ||
"go.uber.org/zap/zapcore" | ||
) | ||
|
||
// NewEncoder returns the new bytedance/sonic/encoder.StreamEncoder. | ||
func NewEncoder(w io.Writer) *encoder.StreamEncoder { | ||
return encoder.NewStreamEncoder(w) | ||
func NewEncoder(w io.Writer) zapcore.ReflectedEncoder { | ||
enc := sonic.ConfigFastest.NewEncoder(w) | ||
enc.SetEscapeHTML(false) | ||
|
||
return enc | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters