On Fri, Nov 15, 2019 at 02:05:11PM +0100, Philipp Hahn wrote:
Hello Daniel,
I regularly visit your blog and stumbled over
<
https://www.berrange.com/posts/2017/01/05/announce-new-libvirt-project-go...;,
which seems to contains some small errors - I'm a "go"-newby, so I had
to spend some time to understand your example and to make it go:
> import (
> libvirt "github.com/libvirt/libvirt-go"
> libvirtxml "github.com/libvirt/libvirt-go-xml"
> "encoding/xml"
> "fmt"
> )
>
> conn, err := libvirt.NewConnect("qemu:///system")
> dom := conn.LookupDomainByName("demo")
This also returns a tuple (dom, err), so should look like:
dom, err := conn.LookupDomainByName("demo")
> xmldoc, err := dom.GetXMLDesc(0)
>
> domcfg := &libvirtxml.Domain{}
> err := xml.Unmarshal([]byte(xmldocC), domcfg)
This fails as "err" is already defined. Should be '=' instead of
':=':
err = xml.Unmarshal([]byte(xmldocC), domcfg)
>
> fmt.Printf("Virt type %s", domcfg.Type)
Maybe add an "\n" at the end?
And maybe also add the wrapper
> package main
...
> func main() {
...
> }
to make the example complete?
Yes, all good suggestions. FYI this text from my blog is
copied into the libvirt-go-xml docs if you fancy sending
a fix for these:
https://libvirt.org/git/?p=libvirt-go-xml.git;a=blob;f=doc.go;hb=HEAD
Second is
<
https://www.berrange.com/posts/2017/01/26/announce-new-libvirt-console-pr...;:
Do you (or someone else) still work on libvirt-console-proxy? It no
longer compiles after several API changed in libvirt-go-xml and uuid.
I have attached several patches, which at least allow compiling again,
I only tested is briefly.
Thank you for your patches, I've applied them all, and also added
support for "go mod" to replace the deprecated glide tool.
It is best to consider the project dormant right now. As you can see
from the git history I've not done any work on it for a while. I still
think its a conceptually useful thing to have but it needs someone with
time & motiviation to take it forward.
Regards,
Daniel
--
|:
https://berrange.com -o-
https://www.flickr.com/photos/dberrange :|
|:
https://libvirt.org -o-
https://fstop138.berrange.com :|
|:
https://entangle-photo.org -o-
https://www.instagram.com/dberrange :|