metaleap/go-xsd

Nil pointer dereference

coussej opened this issue · 1 comments

Hi, first of all thanks for this package!

I'm trying to generate go structs from the file AllSchemas.xsd. I use the following command...

xsd-makepkg -local=true -uri="AllSchemas.xsd" -basepath="github.com/coussej/b2mml"

... which results in a nil pointer dereference error:

2017/04/18 11:59:14 LOAD:	AllSchemas.xsd
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x70 pc=0x7707a]

goroutine 1 [running]:
panic(0x256580, 0xc4200140b0)
	/usr/local/Cellar/go/1.7.1/libexec/src/runtime/panic.go:500 +0x1a1
github.com/metaleap/go-xsd.(*RestrictionSimpleEnumeration).makePkg(0xc420123c80, 0xc42028a000)
	/Users/coussej/Code/go/src/github.com/metaleap/go-xsd/elemmakepkg.go:620 +0x8a
github.com/metaleap/go-xsd.(*hasElemsEnumeration).makePkg(0xc4201944e0, 0xc42028a000)
	/Users/coussej/Code/go/src/github.com/metaleap/go-xsd/hasmakepkg.go:89 +0x55
github.com/metaleap/go-xsd.(*RestrictionSimpleContent).makePkg(0xc420194420, 0xc42028a000)
	/Users/coussej/Code/go/src/github.com/metaleap/go-xsd/elemmakepkg.go:605 +0x111
github.com/metaleap/go-xsd.(*hasElemRestrictionSimpleContent).makePkg(0xc42013ee70, 0xc42028a000)
	/Users/coussej/Code/go/src/github.com/metaleap/go-xsd/hasmakepkg.go:221 +0x47
github.com/metaleap/go-xsd.(*SimpleContent).makePkg(0xc42013ee00, 0xc42028a000)
	/Users/coussej/Code/go/src/github.com/metaleap/go-xsd/elemmakepkg.go:731 +0x73
github.com/metaleap/go-xsd.(*hasElemSimpleContent).makePkg(0xc4200f1f78, 0xc42028a000)
	/Users/coussej/Code/go/src/github.com/metaleap/go-xsd/hasmakepkg.go:251 +0x47
github.com/metaleap/go-xsd.(*ComplexType).makePkg(0xc4200f1e60, 0xc42028a000)
	/Users/coussej/Code/go/src/github.com/metaleap/go-xsd/elemmakepkg.go:179 +0x371
github.com/metaleap/go-xsd.(*hasElemsComplexType).makePkg(0xc4200c0b80, 0xc42028a000)
	/Users/coussej/Code/go/src/github.com/metaleap/go-xsd/hasmakepkg.go:71 +0x55
github.com/metaleap/go-xsd.(*Schema).makePkg(0xc4200c0a00, 0xc42028a000)
	/Users/coussej/Code/go/src/github.com/metaleap/go-xsd/elemmakepkg.go:705 +0xd6
github.com/metaleap/go-xsd.(*Schema).MakeGoPkgSrcFile(0xc4200c0500, 0xe, 0xc420055e01, 0xc4200c0500, 0x0)
	/Users/coussej/Code/go/src/github.com/metaleap/go-xsd/xsd-schema.go:171 +0x377
main.main()
	/Users/coussej/Code/go/src/github.com/metaleap/go-xsd/xsd-makepkg/main.go:65 +0x21a

I also tried serving the files over a local server, but this results in the exact same error!

The complete schema can be found attached: b2mml.zip

Any ideas?

Try the various forks of go-xsd that appeared over the years: https://github.com/metaleap/go-xsd/network --- I'm not maintaining/supporting/pondering this package at all nowadays =)