github.com/bytedance/sonic@v1.11.7-0.20240517092252-d2edb31b167b/issue_test/plugin/main.go (about)

     1  package main
     2  
     3  import (
     4      `fmt`
     5  
     6      `github.com/bytedance/sonic`
     7  )
     8  
     9  var V int
    10  
    11  var Obj map[string]string
    12  
    13  func init() {
    14      if err := sonic.UnmarshalString(`{"a":"b"}`, &Obj); err != nil {
    15          panic(err)
    16      }
    17  }
    18  
    19  func F() { fmt.Printf("Hello, number %d\n", V) }
    20  
    21  func Unmarshal(json string, val interface{}) error {
    22      return sonic.UnmarshalString(json, val)
    23  }