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: another problem with zero values in arrays #934

Closed
gopherbot opened this issue Jul 20, 2010 · 2 comments
Closed

encoding/gob: another problem with zero values in arrays #934

gopherbot opened this issue Jul 20, 2010 · 2 comments

Comments

@gopherbot
Copy link

by sonia1427:

What steps will reproduce the problem?

package main

import (
    "bytes"
    "fmt"
    "gob"
)

func main() {
    a := [3]int{2, 1, 0}
    b := new(bytes.Buffer)
    gob.NewEncoder(b).Encode(a)
    err := gob.NewDecoder(b).Decode(&a)
    fmt.Println(err)
}

What is the expected output?
<nil>

What do you see instead?
gob: length mismatch in decodeArray

What is your $GOOS?  $GOARCH?
linux amd64

Which revision are you using?  (hg identify)
20b5026b3332+ tip

Please provide any additional information below.
This is a little different than issue #459.  That regression test on arrays inside of
structs still passes.  This naked array (which wasn't allowed at the time of issue #459)
fails.  Also, it only seems to fail when a trailing element is zero.  Zeros at the
beginning and middle are okay.
@adg
Copy link
Contributor

adg commented Jul 21, 2010

Comment 1:

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

Status changed to Accepted.

@robpike
Copy link
Contributor

robpike commented Jul 21, 2010

Comment 2:

This issue was closed by revision a0d1c92.

Status changed to Fixed.

@mikioh mikioh changed the title gob: another problem with zero values in arrays encoding/gob: another problem with zero values in arrays Feb 26, 2015
@golang golang locked and limited conversation to collaborators Jun 24, 2016
@rsc rsc unassigned robpike Jun 22, 2022
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants