You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$ ls
gencode.schema main.go
$ cat main.go
package main
//go:generate gencode go -schema gencode.schema
func main() {
var x Foo
x.Unmarshal([]byte{})
}
$ cat gencode.schema
struct Foo {
Bar byte
}
$ go generate
$ go run main.go gencode.schema.gen.go
panic: runtime error: index out of range
goroutine 1 [running]:
main.(*Foo).Unmarshal(...)
/home/tv/go/src/eagain.net/2018/gencode-bug/gencode.schema.gen.go:45
main.main()
/home/tv/go/src/eagain.net/2018/gencode-bug/main.go:7 +0x11
exit status 2
$
The text was updated successfully, but these errors were encountered:
Had the same issue when internally mismatching schemas. Could be ok for internal use but over network this is deal breaker...
Size checking should slow marshal/unmarshal ops so having a -safe option to generate not-panickable code could be great to keep performances where needed
The text was updated successfully, but these errors were encountered: