diff mbox series

[v3,22/22] golang/xenlight: add error return type to Context.Cpupoolinfo

Message ID 76e35746cd42c7aba992cc767f7afe3b1041c6f8.1575990937.git.rosbrookn@ainfosec.com (mailing list archive)
State Superseded
Headers show
Series generated Go libxl bindings using IDL | expand

Commit Message

Nick Rosbrook Dec. 10, 2019, 3:47 p.m. UTC
From: Nick Rosbrook <rosbrookn@ainfosec.com>

A previous commit that removed Context.CheckOpen revealed
an ineffectual assignent to err in Context.Cpupoolinfo, as
there is no error return type.

Since it appears that the intent is to return an error here,
add an error return value to the function signature.

Signed-off-by: Nick Rosbrook <rosbrookn@ainfosec.com>
---
 tools/golang/xenlight/xenlight.go | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

George Dunlap Dec. 17, 2019, 5:29 p.m. UTC | #1
On 12/10/19 3:47 PM, Nick Rosbrook wrote:
> From: Nick Rosbrook <rosbrookn@ainfosec.com>
> 
> A previous commit that removed Context.CheckOpen revealed
> an ineffectual assignent to err in Context.Cpupoolinfo, as
> there is no error return type.
> 
> Since it appears that the intent is to return an error here,
> add an error return value to the function signature.
> 
> Signed-off-by: Nick Rosbrook <rosbrookn@ainfosec.com>

Reviewed-by: George Dunlap <george.dunlap@citrix.com>
diff mbox series

Patch

diff --git a/tools/golang/xenlight/xenlight.go b/tools/golang/xenlight/xenlight.go
index 1c431fa4e5..38d2ba8aa8 100644
--- a/tools/golang/xenlight/xenlight.go
+++ b/tools/golang/xenlight/xenlight.go
@@ -503,17 +503,17 @@  func (Ctx *Context) ListCpupool() (list []Cpupoolinfo) {
 }
 
 // int libxl_cpupool_info(libxl_ctx *ctx, libxl_cpupoolinfo *info, uint32_t poolid);
-func (Ctx *Context) CpupoolInfo(Poolid uint32) (pool Cpupoolinfo) {
+func (Ctx *Context) CpupoolInfo(Poolid uint32) (pool Cpupoolinfo, err error) {
 	var c_cpupool C.libxl_cpupoolinfo
 
 	ret := C.libxl_cpupool_info(Ctx.ctx, &c_cpupool, C.uint32_t(Poolid))
 	if ret != 0 {
-		//err = Error(-ret)
+		err = Error(-ret)
 		return
 	}
 	defer C.libxl_cpupoolinfo_dispose(&c_cpupool)
 
-	_ = pool.fromC(&c_cpupool)
+	err = pool.fromC(&c_cpupool)
 
 	return
 }