Skip to content

Commit

Permalink
fix: Write version warning to stderr (#761)
Browse files Browse the repository at this point in the history
  • Loading branch information
roysc authored Mar 6, 2025
1 parent 768ec28 commit d03a290
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
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

0 comments on commit d03a290

Please sign in to comment.