Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Write version warning to stderr #761

Merged
merged 3 commits into from
Mar 6, 2025
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
4 changes: 3 additions & 1 deletion ast/api_compat.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,16 @@ package ast

import (
`encoding/json`
`fmt`
`os`
`unicode/utf8`

`github.com/bytedance/sonic/internal/native/types`
`github.com/bytedance/sonic/internal/rt`
)

func init() {
println("WARNING:(ast) sonic only supports go1.17~1.23, but your environment is not suitable")
fmt.Fprintln(os.Stderr, "WARNING:(ast) sonic only supports go1.17~1.23, but your environment is not suitable")
}

func quote(buf *[]byte, val string) {
Expand Down
4 changes: 3 additions & 1 deletion decoder/decoder_compat.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ package decoder
import (
"bytes"
"encoding/json"
"fmt"
"io"
"os"
"reflect"
"unsafe"

Expand All @@ -32,7 +34,7 @@ import (
)

func init() {
println("WARNING: sonic/decoder only supports (Go1.17~1.23 && CPU amd64) or (go1.20~1.23 && CPU arm64), but your environment is not suitable")
fmt.Fprintln(os.Stderr, "WARNING: sonic/decoder only supports (Go1.17~1.23 && CPU amd64) or (go1.20~1.23 && CPU arm64), but your environment is not suitable")
}

const (
Expand Down
6 changes: 4 additions & 2 deletions encoder/encoder_compat.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
package encoder

import (
`io`
`io`
`fmt`
`os`
`bytes`
`encoding/json`
`reflect`
Expand All @@ -28,7 +30,7 @@ import (
)

func init() {
println("WARNING:(encoder) sonic only supports (Go1.17~1.23 && CPU amd64) or (G01.20~1.23 && CPU arm64) , but your environment is not suitable")
fmt.Fprintln(os.Stderr, "WARNING:(encoder) sonic only supports (Go1.17~1.23 && CPU amd64) or (G01.20~1.23 && CPU arm64) , but your environment is not suitable")
}

// EnableFallback indicates if encoder use fallback
Expand Down
Loading