github.com/goshafaq/sonic@v0.0.0-20231026082336-871835fb94c6/issue_test/plugin/main.go (about)

     1  package main
     2  
     3  import (
     4  	"fmt"
     5  
     6  	"github.com/goshafaq/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  }