Skip to content
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

encoding/gob: fails with nested interface values #1416

Closed
robpike opened this issue Jan 14, 2011 · 2 comments
Closed

encoding/gob: fails with nested interface values #1416

robpike opened this issue Jan 14, 2011 · 2 comments
Assignees

Comments

@robpike
Copy link
Contributor

@robpike robpike commented Jan 14, 2011

reported by taru karttunen. this program fails.

i know the bug, the fix will take some thinking.  putting it here to track.

package main

import "gob"
import "bytes"

type F struct {
    Contents
}

type Contents interface {}

type T struct {}

func main() {
    var buf bytes.Buffer
    e := gob.NewEncoder(&buf)
    d := gob.NewDecoder(&buf)
    gob.Register(new(F))
    gob.Register(new(T))
    f := &F{&T{}}
    var v interface{} = f
    err := e.Encode(&v)
    if err!=nil { panic("Encode: "+err.String()) }
    err  = d.Decode(&v)
    if err!=nil { panic("Decode: "+err.String()) }
}
@robpike
Copy link
Contributor Author

@robpike robpike commented Jan 19, 2011

Comment 1:

Status changed to Started.

@robpike
Copy link
Contributor Author

@robpike robpike commented Jan 28, 2011

Comment 2:

This issue was closed by revision 9b82481.

Status changed to Fixed.

@robpike robpike added fixed labels Jan 28, 2011
@robpike robpike self-assigned this Jan 28, 2011
@mikioh mikioh changed the title gob fails with nested interface values encoding/gob: fails with nested interface values Feb 26, 2015
@golang golang locked and limited conversation to collaborators Jun 24, 2016
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.