mirror of
https://github.com/ii64/sonic.git
synced 2026-06-21 00:46:43 +08:00
* fix:(loader) init `_Moduledata.gcdata`pointer to avoid panic on plugin-mode * fix: freeze gcdata pointer * feat: go115 * update test * fix: use unique bytes pointer * test: drop go1.15 race test * feat: support go1.18
23 lines
368 B
Go
23 lines
368 B
Go
package main
|
|
|
|
import (
|
|
`fmt`
|
|
|
|
`github.com/bytedance/sonic`
|
|
)
|
|
|
|
var V int
|
|
|
|
var Obj map[string]string
|
|
|
|
func init() {
|
|
if err := sonic.UnmarshalString(`{"a":"b"}`, &Obj); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|
|
|
|
func F() { fmt.Printf("Hello, number %d\n", V) }
|
|
|
|
func Unmarshal(json string, val interface{}) error {
|
|
return sonic.UnmarshalString(json, val)
|
|
}
|