[lxc-devel] [go-lxc/v2] lxc-binding: report devel in version string

brauner on Github lxc-bot at linuxcontainers.org
Sat Mar 11 17:40:04 UTC 2017


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 365 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20170311/ad85e109/attachment.bin>
-------------- next part --------------
From c61cc4d9f63988372dbc7565573e5dc73196e098 Mon Sep 17 00:00:00 2001
From: Christian Brauner <christian.brauner at ubuntu.com>
Date: Sat, 11 Mar 2017 18:38:31 +0100
Subject: [PATCH] lxc-binding: report devel in version string

Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>
---
 lxc-binding.go | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/lxc-binding.go b/lxc-binding.go
index 5d68ce5..8737ffd 100644
--- a/lxc-binding.go
+++ b/lxc-binding.go
@@ -17,6 +17,7 @@ package lxc
 import "C"
 
 import (
+	"fmt"
 	"runtime"
 	"unsafe"
 )
@@ -62,7 +63,11 @@ func Release(c *Container) bool {
 
 // Version returns the LXC version.
 func Version() string {
-	return C.GoString(C.lxc_get_version())
+	version := C.GoString(C.lxc_get_version())
+	if C.LXC_DEVEL == 1 {
+		fmt.Sprintf("%s (devel)", version)
+	}
+	return version
 }
 
 // GlobalConfigItem returns the value of the given global config key.


More information about the lxc-devel mailing list