diff --git a/ast/api_compat.go b/ast/api_compat.go index 6541e219d..a2efe5402 100644 --- a/ast/api_compat.go +++ b/ast/api_compat.go @@ -20,6 +20,8 @@ package ast import ( `encoding/json` + `fmt` + `os` `unicode/utf8` `github.com/bytedance/sonic/internal/native/types` @@ -27,7 +29,7 @@ import ( ) 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) { diff --git a/decoder/decoder_compat.go b/decoder/decoder_compat.go index 408d59394..0ee9d96bc 100644 --- a/decoder/decoder_compat.go +++ b/decoder/decoder_compat.go @@ -22,7 +22,9 @@ package decoder import ( "bytes" "encoding/json" + "fmt" "io" + "os" "reflect" "unsafe" @@ -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 ( diff --git a/encoder/encoder_compat.go b/encoder/encoder_compat.go index 254defa20..786e46ff3 100644 --- a/encoder/encoder_compat.go +++ b/encoder/encoder_compat.go @@ -19,7 +19,9 @@ package encoder import ( - `io` + `io` + `fmt` + `os` `bytes` `encoding/json` `reflect` @@ -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