Go (golang) Bindings for LXC C API

619 views
Skip to first unread message

S.Çağlar Onur

unread,
Mar 28, 2013, 10:52:47 PM3/28/13
to golan...@googlegroups.com
Hi,

A couple of days ago I started to write the Go binding for LXC C API. IMHO it reached to a point where I can announce it officially. So here it is;

Go (golang) Bindings for LXC (Linux Containers) [1]

You can install it via regular "go get" magic

go get github.com/caglar10ur/lxc

and checkout the documentation [1] and bunch of basic examples [2].


Please note that it's an early alpha, where the code hasn't been refactored and not much tested in the wild.

It's using new functionalities introduced by upcoming LXC 0.9 so it won't work with older releases. It's been developed on Ubuntu 12.10 against LXC staging tree [4].

Currently it provides all the exported API but it doesn't have additional features like Python LXC API (.network property, get_ips, clone, attach functions etc.).

I'd appreciate you guys taking a look at it, using it, breaking it and giving me feedback :)

[1] https://github.com/caglar10ur/lxc
[2] http://godoc.org/github.com/caglar10ur/lxc
[3] https://github.com/caglar10ur/lxc/tree/master/examples
[4] https://github.com/lxc/lxc/

Cheers,
--
S.Çağlar Onur <cag...@10ur.org>

Tamás Gulácsi

unread,
Mar 29, 2013, 2:01:25 AM3/29/13
to golan...@googlegroups.com
Maybe docker.io could profit from this ...

Albert Strasheim

unread,
Apr 27, 2013, 10:26:58 AM4/27/13
to golan...@googlegroups.com, bmulla...@gmail.com
On Saturday, April 27, 2013 2:33:09 PM UTC+2, bmulla...@gmail.com wrote:
Just tried to install this on my ubuntu 13.04 and got this error:
container.go:25:21: fatal error: lxc/lxc.h: No such file or directory
compilation terminated.

You want something like: apt-get install lxc-dev

brian mullan

unread,
Apr 27, 2013, 11:40:40 AM4/27/13
to Albert Strasheim, golan...@googlegroups.com
$ sudo apt-get install lxc-dev

then the following still gives an error
container.go:270[/tmp/go-build877302421/github.com/caglar10ur/lxc/_obj/container.cgo1.go:284]: function ends without a return statement


minux

unread,
Apr 27, 2013, 11:56:41 AM4/27/13
to brian mullan, Albert Strasheim, golan...@googlegroups.com
On Sat, Apr 27, 2013 at 11:40 PM, brian mullan <bmulla...@gmail.com> wrote:
$ sudo apt-get install lxc-dev

then the following still gives an error
container.go:270[/tmp/go-build877302421/github.com/caglar10ur/lxc/_obj/container.cgo1.go:284]: function ends without a return statement
the author is using Go 1.1 beta (or tip), and Go 1.1 uses a revised rule regarding terminating statements

one option is to upgrade to Go 1.1 beta (or tip), another is patch container.go, and add a
   panic("unreachable")
at line 278.

S.Çağlar Onur

unread,
Apr 27, 2013, 2:13:37 PM4/27/13
to golan...@googlegroups.com, brian mullan, Albert Strasheim
Hey Brian,
Minux is right, I'm using Go tip all the time. I'll test it with Go 1.0.3 and fix those errors, in the meantime please feel free to submit a patch if you already fixed something.

P.S: For the future, I suggest using github to report those kind of problems [1] as IMHO it would be much more easy to track


Best,
 
Reply all
Reply to author
Forward
0 new messages