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: does not properly encode functions #1339

Closed
gopherbot opened this issue Dec 12, 2010 · 7 comments
Closed

encoding/gob: does not properly encode functions #1339

gopherbot opened this issue Dec 12, 2010 · 7 comments
Assignees

Comments

@gopherbot
Copy link

@gopherbot gopherbot commented Dec 12, 2010

by Nazgand:

Before filing a bug, please check whether it has been fixed since
the latest release: run "hg pull -u" and retry what you did to
reproduce the problem.  Thanks.

What steps will reproduce the problem?
1. Use gob to save a function to a file
2. look at the size of the file
3.

What is the expected output?
A file larger than 0 bytes.

What do you see instead?
A file with 0 bytes.

Which compiler are you using (5g, 6g, 8g, gccgo)?
6g

Which operating system are you using?
Ubuntu 10.04

Which revision are you using?  (hg identify)
a544d1957b0f tip

Please provide any additional information below.
 This bug was found when trying to make a server that could keep running if you want to recompile a function. It would use Inotify to look at .func files and load them when modified. But gob does not work, and I have been unable to find a workaround.

Attachments:

  1. funcCompiler.go (522 bytes)
@alberts
Copy link
Contributor

@alberts alberts commented Dec 13, 2010

Comment 1:

gob might not be the right place to do this kind of thing.
@rsc
Copy link
Contributor

@rsc rsc commented Dec 13, 2010

Comment 2:

Check the error return from enc.Encode:
    gob: can't encode type func(http.ResponseWriter, *http.Request)

Owner changed to r...@golang.org.

Status changed to WorkingAsIntended.

@gopherbot
Copy link
Author

@gopherbot gopherbot commented Dec 13, 2010

Comment 3 by Nazgand:

The error is
gob: can't encode type func(http.ResponseWriter, *http.Request)
Similar errors I got were:
gob: can't encode type func(string) string
gob: can't encode type func() string
gob: can't encode type func()
@rsc
Copy link
Contributor

@rsc rsc commented Dec 13, 2010

Comment 4:

Yes, gob does not support encoding functions.
@gopherbot
Copy link
Author

@gopherbot gopherbot commented Dec 13, 2010

Comment 5 by Nazgand:

I think gob should be able to at least do simpler ones that use no packages for their
inputs or outputs.
@rsc
Copy link
Contributor

@rsc rsc commented Dec 13, 2010

Comment 6:

Discussion of this topic should be directed to golang-nuts@googlegroups.com.
@robpike
Copy link
Contributor

@robpike robpike commented Dec 13, 2010

Comment 7:

Perhaps you want Erlang.  Go is a compiled language that needs linking and other things.
It simply cannot do this without fundamental changes.
@mikioh mikioh changed the title gob does not properly encode functions encoding/gob: does not properly encode functions 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
4 participants
You can’t perform that action at this time.