We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Panic on json.Marshal():
json.Marshal()
unexpected fault address 0x7068616c2d20736c fatal error: fault [signal SIGSEGV: segmentation violation code=0x2 addr=0x7068616c2d20736c pc=0x100fb145c] goroutine 1 [running]: runtime.throw(0x10100e37c, 0x5) /opt/homebrew/Cellar/go/1.16.5/libexec/src/runtime/panic.go:1117 +0x54 fp=0x140001254d0 sp=0x140001254a0 pc=0x100f1beb4 runtime.sigpanic() /opt/homebrew/Cellar/go/1.16.5/libexec/src/runtime/signal_unix.go:741 +0x230 fp=0x14000125510 sp=0x140001254d0 pc=0x100f30e90 github.com/goccy/go-json/internal/encoder.AppendString(0x14000061860, 0x14000020400, 0xd, 0x400, 0x7068616c2d20736c, 0x7572203a63696e61, 0x0, 0x0, 0x0) /Users/thearas/go/pkg/mod/github.com/goccy/go-json@v0.7.3/internal/encoder/string.go:422 +0x9c fp=0x14000125610 sp=0x14000125520 pc=0x100fb145c github.com/goccy/go-json/internal/encoder/vm.Run(0x14000061860, 0x14000020400, 0xd, 0x400, 0x14000024100, 0x0, 0x0, 0x0, 0x0, 0x0) /Users/thearas/go/pkg/mod/github.com/goccy/go-json@v0.7.3/internal/encoder/vm/vm.go:114 +0x1eb0 fp=0x14000127d40 sp=0x14000125610 pc=0x100fdea10 github.com/goccy/go-json.encodeRunCode(0x14000061860, 0x14000020400, 0x0, 0x400, 0x14000024100, 0x14000061860, 0x14000127e28, 0x10100d14c, 0x10105b8a0, 0x14000061860) /Users/thearas/go/pkg/mod/github.com/goccy/go-json@v0.7.3/encode.go:307 +0x170 fp=0x14000127da0 sp=0x14000127d40 pc=0x10100d7e0 github.com/goccy/go-json.encode(0x14000061860, 0x10105dcc0, 0x1400007c000, 0x0, 0x0, 0x14000018100, 0x14000067e98, 0x100f903e4) /Users/thearas/go/pkg/mod/github.com/goccy/go-json@v0.7.3/encode.go:232 +0x1ac fp=0x14000127e30 sp=0x14000127da0 pc=0x10100d4bc github.com/goccy/go-json.marshal(0x10105dcc0, 0x1400007c000, 0x0, 0x0, 0x0, 0x1f, 0x20, 0x14000014200, 0x1400007e000, 0x14000018100) /Users/thearas/go/pkg/mod/github.com/goccy/go-json@v0.7.3/encode.go:147 +0xbc fp=0x14000127ec0 sp=0x14000127e30 pc=0x10100d1dc github.com/goccy/go-json.MarshalWithOption(...) /Users/thearas/go/pkg/mod/github.com/goccy/go-json@v0.7.3/json.go:186 github.com/goccy/go-json.Marshal(0x10105dcc0, 0x1400007c000, 0x14000018100, 0x1f, 0x20, 0x0, 0x0) /Users/thearas/go/pkg/mod/github.com/goccy/go-json@v0.7.3/json.go:171 +0x38 fp=0x14000127f20 sp=0x14000127ec0 pc=0x10100d858 main.main() /Users/thearas/playground/go-json/main.go:33 +0xc0 fp=0x14000127f70 sp=0x14000127f20 pc=0x10100dd80 runtime.main() /opt/homebrew/Cellar/go/1.16.5/libexec/src/runtime/proc.go:225 +0x26c fp=0x14000127fd0 sp=0x14000127f70 pc=0x100f1e35c runtime.goexit() /opt/homebrew/Cellar/go/1.16.5/libexec/src/runtime/asm_arm64.s:1130 +0x4 fp=0x14000127fd0 sp=0x14000127fd0 pc=0x100f4b864 exit status 2
go version go1.16.5 darwin/arm64
Just run the code:
package main import ( "encoding/json" gojson "github.com/goccy/go-json" ) type MyStruct struct { Foo *Foo `json:"foo,omitempty"` } type Foo struct { A []string `json:"a"` B int `json:"b"` } func main() { s := MyStruct{ Foo: &Foo{ A: []string{"ls -lah"}, B: 0, }, } // encoding/json: Work fine _, err := json.Marshal(s) if err != nil { panic(err) } // go-json: Panic with SIGSEGV!!! _, _ = gojson.Marshal(s) }
The text was updated successfully, but these errors were encountered:
Successfully merging a pull request may close this issue.
Panic on
json.Marshal()
:Env
go version go1.16.5 darwin/arm64
Step to reproduce
Just run the code:
The text was updated successfully, but these errors were encountered: