On Wed, Feb 19, 2020 at 02:30:45PM +0100, Csaba Henk wrote:
Go API functions returned (<val>, *GuestfsError) that made
code like this fail to build:
n, err := os.Stdin.Read(buf)
if err != nil {
log.Fatal(err)
}
n, err = g.Pwrite_device(dev, buf[:n], off)
...
As err should be of error (interface) type as of the stdlib call,
and should be of *GuestfsError type as of the libguestfs call.
The concrete error value that libguestfs functions return can be
a *GuestfsError, but the function signature should have (<val>, error)
as return value.
Thanks - pushed.
The bindtests fail with a rather obscure error. I don't know what it
means or if it's related to this patch.
==============================================
libguestfs 1.41.8: golang/test-suite.log
==============================================
# TOTAL: 2
# PASS: 1
# SKIP: 0
# XFAIL: 0
# FAIL: 1
# XPASS: 0
# ERROR: 0
.. contents:: :depth: 2
FAIL: run-bindtests
===================
panic: runtime error: cgo argument has Go pointer to Go pointer
goroutine 1 [running]:
libguestfs.org/guestfs.(*Guestfs).Internal_test.func7(0xc000010028, 0x107a430, 0x1078a20,
0xc000010050, 0xc000000000, 0x0, 0x0, 0x1079ec0, 0x1075190, 0x10751b0, ...)
/home/rjones/d/libguestfs/golang/src/libguestfs.org/guestfs/guestfs.go:6667 +0xf7
libguestfs.org/guestfs.(*Guestfs).Internal_test(0xc000010028, 0x4f3f43, 0x3, 0xc000063b90,
0xc000063aa0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
/home/rjones/d/libguestfs/golang/src/libguestfs.org/guestfs/guestfs.go:6667 +0x3cc
main.main()
/home/rjones/d/libguestfs/golang/bindtests.go:77 +0x127d
exit status 2
FAIL run-bindtests (exit status: 1)
Rich.
--
Richard Jones, Virtualization Group, Red Hat
http://people.redhat.com/~rjones
Read my programming and virtualization blog:
http://rwmj.wordpress.com
virt-builder quickly builds VMs from scratch
http://libguestfs.org/virt-builder.1.html