Closed
Description
found this error porting https://github.com/metaleap/go-xsd to gcccode.
It seems that the reflection is failing here. The sub object is private but the field contained is public.
This is different in gccgo than go playground.
package main
import "fmt"
import "encoding/xml"
type hasFoo3 struct {
Blah3 int
}
type Foo struct {
hasFoo3
}
func main() {
fmt.Println("Hello, playground")
var encoded []byte
var err error
var vP Foo
encoded, err = xml.Marshal(vP)
fmt.Printf("%s err:%v\n", encoded, err)
err = xml.Unmarshal(encoded, &vP)
fmt.Printf("Unmarshal %v %s", vP, err)
}
see https://play.golang.org/p/w_FzGI3LvW
Output with the playground
Hello, playground
<Foo><Blah3>0</Blah3></Foo> err:<nil>
Unmarshal {{0}} %!s(<nil>)
output with gcc-go-5
Hello, playground
<Foo></Foo> err:<nil>
Unmarshal {{0}} %!s(<nil>)
using gccgo-5 (Debian 5-20150226-1) 5.0.0 20150226 (experimental) [trunk revision 220999]