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
encode works but when i try to decode with below function :
`func decodeGob(gobData bytes.Buffer, targetType interface{}) error {
gob.Register(ast.StringToken{})
gob.Register(ast.Object{})
gob.Register(ast.Elements{})
gob.Register(ast.TemplateString{})
d := gob.NewDecoder(&gobData)
if err := d.Decode(targetType); err != nil {
return err
}
return nil
}
`
Its throwing error as below:
gob: ast.TemplateString is not assignable to type ast.Value
The text was updated successfully, but these errors were encountered:
The ast object is totally under gocc's user's control. So it is up to you to create an ast that is serializable. I usually make my asts protobuf objects.
I have worked it out it was problem where the ast.TemplateString was implementing the interface ast.Value but ast.TemplateString methods were having pointer reciever , i had to remove the pointer reciever to make it work...
I am trying to serialize an AST object using gob with below function:
//Encodes an object in gob
encode works but when i try to decode with below function :
`func decodeGob(gobData bytes.Buffer, targetType interface{}) error {
gob.Register(ast.StringToken{})
gob.Register(ast.Object{})
gob.Register(ast.Elements{})
gob.Register(ast.TemplateString{})
}
`
Its throwing error as below:
gob: ast.TemplateString is not assignable to type ast.Value
The text was updated successfully, but these errors were encountered: