unmarshal [] into a slice makes the slice nil, not empty

Bug #1231527 reported by Nate Finch
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
goyaml
New
Undecided
Unassigned

Bug Description

code:
package main

import "launchpad.net/goyaml"
import "fmt"

func main() {
 s := []string{}
 data, _ := goyaml.Marshal(s)
 fmt.Printf("%s\n", string(data))
 var s2 []string
 goyaml.Unmarshal(data, &s2)
 fmt.Printf("%#v\n", s2)
}

output:
[]

[]string(nil)

expected output:
[]

[]string{}

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.