Idiot-proof how to install and use go-xsd
Closed this issue · 6 comments
Being an idiot - I still have absolutely no idea on how to use this tool after reading the README.
As the title says it - may I suggest an idiot-proof guide on how to install and use this package for all idiots out there like me. It could be a step by step guide for instance.
For example;
- go get github.com/metaleap/go-xsd
- ...
Much thanks!
+1 on improving the readme, but FYI the command you're looking for is
go get -u github.com/metaleap/go-xsd/xsd-makepkg
So how do you use this?
Ran: xsd-makepkg service.xsd
2017/05/18 18:57:16 LOAD: www.w3.org/2001/xml.xsd
2017/05/18 18:57:16 MKPKG: /home/preston/go/src/github.com/metaleap/go-xsd-pkg/www.w3.org/2001/xml.xsd_go/xml.xsd.go
2017/05/18 18:57:16 GOINST: exec: "go-buildrun": executable file not found in $PATH
2017/05/18 18:57:16 LOAD: www.w3.org/2001/03/xml.xsd
2017/05/18 18:57:16 MKPKG: /home/preston/go/src/github.com/metaleap/go-xsd-pkg/www.w3.org/2001/03/xml.xsd_go/xml.xsd.go
2017/05/18 18:57:16 GOINST: exec: "go-buildrun": executable file not found in $PATH
2017/05/18 18:57:16 LOAD: www.w3.org/TR/2002/WD-SVG11-20020108/xml.xsd
2017/05/18 18:57:16 MKPKG: /home/preston/go/src/github.com/metaleap/go-xsd-pkg/www.w3.org/TR/2002/WD-SVG11-20020108/xml.xsd_go/xml.xsd.go
2017/05/18 18:57:16 GOINST: exec: "go-buildrun": executable file not found in $PATH
2017/05/18 18:57:16 LOAD: www.w3.org/TR/2002/WD-SVG11-20020108/xlink.xsd
2017/05/18 18:57:16 MKPKG: /home/preston/go/src/github.com/metaleap/go-xsd-pkg/www.w3.org/TR/2002/WD-SVG11-20020108/xlink.xsd_go/xlink.xsd.go
2017/05/18 18:57:16 GOINST: exec: "go-buildrun": executable file not found in $PATH
2017/05/18 18:57:16 LOAD: www.w3.org/TR/2002/WD-SVG11-20020108/SVG.xsd
2017/05/18 18:57:16 MKPKG: /home/preston/go/src/github.com/metaleap/go-xsd-pkg/www.w3.org/TR/2002/WD-SVG11-20020108/SVG.xsd_go/SVG.xsd.go
2017/05/18 18:57:16 GOINST: exec: "go-buildrun": executable file not found in $PATH
2017/05/18 18:57:16 LOAD: www.w3.org/2007/schema-for-xslt20.xsd
2017/05/18 18:57:16 MKPKG: /home/preston/go/src/github.com/metaleap/go-xsd-pkg/www.w3.org/2007/schema-for-xslt20.xsd_go/schema-for-xslt20.xsd.go
2017/05/18 18:57:16 GOINST: exec: "go-buildrun": executable file not found in $PATH
2017/05/18 18:57:16 LOAD: www.w3.org/Math/XMLSchema/mathml2/common/xlink-href.xsd
2017/05/18 18:57:16 MKPKG: /home/preston/go/src/github.com/metaleap/go-xsd-pkg/www.w3.org/Math/XMLSchema/mathml2/common/xlink-href.xsd_go/xlink-href.xsd.go
2017/05/18 18:57:16 GOINST: exec: "go-buildrun": executable file not found in $PATH
2017/05/18 18:57:16 LOAD: www.w3.org/Math/XMLSchema/mathml2/mathml2.xsd
2017/05/18 18:57:16 MKPKG: /home/preston/go/src/github.com/metaleap/go-xsd-pkg/www.w3.org/Math/XMLSchema/mathml2/mathml2.xsd_go/mathml2.xsd.go
2017/05/18 18:57:16 GOINST: exec: "go-buildrun": executable file not found in $PATH
2017/05/18 18:57:16 LOAD: docs.oasis-open.org/election/external/xAL.xsd
2017/05/18 18:57:17 MKPKG: /home/preston/go/src/github.com/metaleap/go-xsd-pkg/docs.oasis-open.org/election/external/xAL.xsd_go/xAL.xsd.go
2017/05/18 18:57:17 GOINST: exec: "go-buildrun": executable file not found in $PATH
2017/05/18 18:57:17 LOAD: docbook.org/xml/5.0/xsd/xml.xsd
2017/05/18 18:57:17 MKPKG: /home/preston/go/src/github.com/metaleap/go-xsd-pkg/docbook.org/xml/5.0/xsd/xml.xsd_go/xml.xsd.go
2017/05/18 18:57:17 GOINST: exec: "go-buildrun": executable file not found in $PATH
2017/05/18 18:57:17 LOAD: docbook.org/xml/5.0/xsd/xlink.xsd
2017/05/18 18:57:17 MKPKG: /home/preston/go/src/github.com/metaleap/go-xsd-pkg/docbook.org/xml/5.0/xsd/xlink.xsd_go/xlink.xsd.go
2017/05/18 18:57:17 GOINST: exec: "go-buildrun": executable file not found in $PATH
2017/05/18 18:57:17 LOAD: docbook.org/xml/5.0/xsd/docbook.xsd
2017/05/18 18:57:17 MKPKG: /home/preston/go/src/github.com/metaleap/go-xsd-pkg/docbook.org/xml/5.0/xsd/docbook.xsd_go/docbook.xsd.go
2017/05/18 18:57:17 GOINST: exec: "go-buildrun": executable file not found in $PATH
2017/05/18 18:57:17 LOAD: kbcafe.com/rss/atom.xsd.xml
2017/05/18 18:57:17 ERROR: expected element type <schema> but have <HTML>
2017/05/18 18:57:17 LOAD: thearchitect.co.uk/schemas/rss-2_0.xsd
2017/05/18 18:57:17 MKPKG: /home/preston/go/src/github.com/metaleap/go-xsd-pkg/thearchitect.co.uk/schemas/rss-2_0.xsd_go/rss-2_0.xsd.go
2017/05/18 18:57:17 GOINST: exec: "go-buildrun": executable file not found in $PATH
2017/05/18 18:57:17 LOAD: schemas.opengis.net/kml/2.2.0/atom-author-link.xsd
2017/05/18 18:57:17 MKPKG: /home/preston/go/src/github.com/metaleap/go-xsd-pkg/schemas.opengis.net/kml/2.2.0/atom-author-link.xsd_go/atom-author-link.xsd.go
2017/05/18 18:57:17 GOINST: exec: "go-buildrun": executable file not found in $PATH
2017/05/18 18:57:17 LOAD: schemas.opengis.net/kml/2.2.0/ogckml22.xsd
2017/05/18 18:57:18 MKPKG: /home/preston/go/src/github.com/metaleap/go-xsd-pkg/schemas.opengis.net/kml/2.2.0/ogckml22.xsd_go/ogckml22.xsd.go
2017/05/18 18:57:18 GOINST: exec: "go-buildrun": executable file not found in $PATH
2017/05/18 18:57:18 LOAD: khronos.org/files/collada_schema_1_4
2017/05/18 18:57:19 MKPKG: /home/preston/go/src/github.com/metaleap/go-xsd-pkg/khronos.org/files/collada_schema_1_4_go/collada_schema_1_4.go
2017/05/18 18:57:20 GOINST: exec: "go-buildrun": executable file not found in $PATH
2017/05/18 18:57:20 LOAD: khronos.org/files/collada_schema_1_5
2017/05/18 18:57:22 MKPKG: /home/preston/go/src/github.com/metaleap/go-xsd-pkg/khronos.org/files/collada_schema_1_5_go/collada_schema_1_5.go
2017/05/18 18:57:23 GOINST: exec: "go-buildrun": executable file not found in $PATH
Then it didn't generate anything. I still just have my xsd file.
I figured it out after reading many of the issues.
-
You have to host the xsd file somewhere and provide it via the URI
-
The package is generated under the URI path rather than where you'd expect (in the working directory)
-
go get -u github.com/metaleap/go-xsd/xsd-makepkg
-
http-server
or similar to host the xsd -
xsd-makepkg -uri="http://192.168.1.100:8080/service.xsd"
-
Copy the go file from the package it was generated. (
$GOPATH/src/192.168.1.100:8080/service.xsd_go/service.xsd.go
)
I was expecting to do xsd-makepkg service.xsd
and it output a service.xsd.go
in the same working directory.
@prestonvanloon You can do so with xsd-makepkg -basepath="`pwd`" -uri="service.xsd"
The above command does not work. You just get
ERROR: Get http://datafile.xsd: dial tcp: lookup service.xsd: no such host
Setting up a webserver is mandatory for this app, it seems. Very odd requirement..