-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cant store json in ybc using golang #14
Comments
This looks like a bug in Go runtime. Will try narrowing down it and posting to Go issue tracker. |
As a temporary workaround you can use |
Minimized it to: package main
// static void foo(void *p) {}
import "C"
import (
"encoding/json"
"unsafe"
)
func main() {
b, err := json.Marshal(123)
if err != nil {
panic(err)
}
p := unsafe.Pointer(&b[0])
C.foo(p)
} |
There is another workaround mentioned in the linked Go issue:
if len(b) <= 64 {
b = append([]byte(nil), b...)
}
if err = cache.Set([]byte("key"), b, time.Hour); err != nil {
panic(err)
} |
Not sure what is going on here...
gives
However, this works fine:
Running:
The text was updated successfully, but these errors were encountered: