Hello everybody!

First, allow me to wish you all a Happy New year!

I have a problem with a small app that I wrote in Go and which uses libvirt go bindings. Actually, the problem exists only when I want to compile the code statically. Basically, when CGO_ENABLED=0 is exported, go (running go test, go run, go build) complains:

undefined: libvirt.NewConnect

When I try to compile the source dynamically (running the same go <command> commands) the app works/checks out as expected and works without any problem.

I tried this on:

- CentOS 7.6 (go version 1.11.2)
- Ubuntu 18.04 LTS (go version 1.10.4)

Both systems - as advised on project's github pages/godoc.org - have libvirt-dev package installed. Also, the libvirt module is imported as advised:

libvirt "github.com/libvirt/libvirt-go"

GOPATH is set to /home/$USER/go

I downloaded the package via go get; go get -v -u github.com/libvirt/libvirt-go. Please if somebody encountered this before, could you give me a hint if possible in order to solve this?

Thank you very much in advance!


Regards,

Branimir