In-flight deb packages of Go

Since relatively early in the public life of the Go language, I’ve been involved in pushing forward packages that might be used in Ubuntu, including making the compiler suite itself happier in such packaged environments. In due time, these packages were moved over to an automatic build system, so that people wouldn’t have to rely on my good will to have up-to-date packages, nor would I have to be regularly spending time maintaining those packages. Or so was the theory.

It’s well known that the real world is not so plain, though, and issues became much more regular than hoped. Some of the issues were caused by changes in the build conventions of Go, others self-inflicted due to my limited knowledge of the extensive conventions around packaging, or bugs in indirect dependencies of the process, and more recently the sub-optimal scheduling algorithm used by the build farm has driven the builds to a halt.

So, the question is how to get out of this rabbit hole, but still give people a convenient way to use Go in Ubuntu.

Enter godeb, an experiment that dynamically translates the upstream builds of Go into deb packages. In practice, it’s a simple standalone Go program that can parse the build list, fetch the requested version, and in memory translate the contents into a correct binary deb package.

Since you cannot build a Go application without a Go compiler first, there’s an x86 32-bit binary and an x86 64-bit binary of godeb available for download. After the compiler is installed, godeb may be fetched and rebuilt locally by running go get

Once the godeb binary is available, it’s easy to get up-to-date packages:

$ ./godeb install
package go_1.1.1-godeb1_amd64.deb ready
Selecting previously unselected package go.
(Reading database ... 488515 files and (...) installed.)
Unpacking go (from go_1.1.1-godeb1_amd64.deb) ...
Setting up go (1.1.1-godeb1) ...

It figures what the most recent build available is, downloads, translates, and installs it, asking for a password via sudo if necessary. Running godeb install again will fetch the latest version (or the requested one) and replace the currently installed package. Package installs default to the same architecture of godeb itself, and may be changed by setting the GOARCH environment variable to 386 or amd64, borrowing from a Go convention.

New releases of Go are immediately available, and so are the old ones:

$ ./godeb list

$ ./godeb -h
Usage: godeb <command> [<options> ...]

Available commands:

    install [<version>]
    download [<version>]

For the time being, I’m holding up maintenance of the Go PPA in Launchpad in favor of this system. Of course, you can still install the golang-* packages on Ubuntu 12.10 and 13.04 from the official repositories as usual.

This entry was posted in Architecture, Design, Go, Project. Bookmark the permalink.

15 Responses to In-flight deb packages of Go

  1. Nigel Vickers says:

    Hallo Gustavo,
    Running 12.04 LTS 32bit with stock golang packages and really stuck in the “rabbit hole”. Will your tool respect the standard paths? Can I just “go get” it , run it without losing all my external imports? Or do have to “remove” stock and start from scratch?
    Kind regards,
    Nigel Vickers

  2. Anton Ageev says:

    I’ve installed Go 1.1.1 on Debian Wheezy with godeb.
    Excellent tool! Thanks!

  3. niemeyer says:

    @Nigel Yes, you won’t lose you existing packages. You may just have to recompile them.

    @Anton Thanks for the note. Glad it’s working there as well.

  4. Well, since there’s no longer anyone maintaining Launchpad PPAs, I’ve taken that up myself. I built the 1.1 packages based on the current Debian 2:1.1-1 version packaging (also already in Ubuntu saucy-proposed as of this writing), and extended that build process to work with 1.1.1. All are built for Ubuntu 10.04 (lucid), 12.04 (precise), 12.10 (quantal), 13.04 (raring), and 13.10 (saucy); and they should work with similar derivatives, e.g. Mint.

    Here’s the PPA:
    (or just do “sudo apt-add-repository ppa:duh/golang”)

    The version numbers are very carefully crafted to work with the version numbering used by Debian and Ubuntu. So if a package of Go 1.1.1 comes out in an official Ubuntu release channel, it will automatically supersede the PPA versions (as it should). Of course, given the speed at which that happens, 1.1.2 may well be out by then. :)

  5. niemeyer says:

    > Well, since there’s no longer anyone maintaining Launchpad PPAs, I’ve taken that up myself.

    This is great, Todd! Thanks for pushing it.

  6. Sébastien Douche says:

    Yeah! Thanks Gustavo. But why only Deb and not a tool like pythonbrew?

  7. weasel says:

    Hi Gustavo,

    I was using golang-tip from the gophers ppa, and it was nice to get the latest version once every few days. But with your program, I cannot do that it seems, it only has the “stable” versions…

    Furthermore, everything was nice and integrated with apt-get and ubuntu updates, now I have to install and use another program (godeb) to install/manage the golang. Why oh why? :(((((

    Can’t you also keep the previous way of doing things (automated builds)? Sorry to say but this godeb seems a bad bad idea. I suppose you only need to use 1 command (godeb install) instead of 3 (add repo, apt-get update, apt-get install), but there is no integration with apt-get, no automatic checking of newer versions, no “tip” releases… :|

  8. niemeyer says:

    > Can’t you also keep the previous way of doing things (automated builds)?

    I apologize for the inconvenience, but not at this time, for the reasons provided in the post.

  9. Fatih Arslan says:

    Works perfect on AWS Ubuntu 13.04 machines. Thank you for your effort!

  10. Stani says:

    Thanks for this wonderful tool. However I have one small annoyance.

    Could you please use a different version scheme for release candidates, e.g. 1.3+rc1 instead of 1.3rc1

    Now “godeb install” does not upgrade 1.2rc5 to to 1.2, so I had the use this instead which logs an unfortunate warning:

    $ godeb install 1.2
    package go_1.2-godeb1_amd64.deb ready
    [sudo] password for stani:
    dpkg: warning: downgrading go from 1.2rc5-godeb1 to 1.2-godeb1

    See “Advanced package versioning”:

  11. niemeyer says:

    Sure, will do. I suspect the most correct way is actually with something like 1.2~rc5, as the tilde sorts before anything else.

    That said, note that it would not “upgrade” anyway, because the package name differs from the official Ubuntu package, and godeb has no upgrade command at this time. You have to explicitly select the version you want instead. So the only real annoyance is the warning message itself.

  12. Stani says:

    I am not using the offical Ubuntu packages, I was using ‘godeb install’ to upgrade ;-)

  13. Peter Waller says:

    It really feels unfortunate to me to go outside of the standard apt ecosystem. It means I can’t trivially say to my configuratoin management “Add this ppa and install this package”, and have it automatically happen on many machines. Now I have to manually interact with each machine to have it install or set up my own pacakge repository. And I don’t get updates automatically either.

    Any chance of revisiting the PPAs and getting a 1.2 release?

    Also, this wiki is now out of date:

  14. Peter Waller says:

    (Also it means I have to tell my friends to go off-piste to install go now, rather than just using apt as they are familiar :[)

  15. niemeyer says:

    Hi Peter,

    As the post mentions, the official Ubuntu packages (imported from Debian in this case) are a well supported mechanism for installing Go. The in-development 14.04 already has Go 1.2, although it was released just a few days ago.

    The process here replaces the out-of-band PPA that I have maintained for a while, and for the reasons given above stopped being practical. It’s worth noting that the godeb tool is itself a Go application, so if they have a Go environment set up (the previous Go toolset from Ubuntu, for example), they can just run go get and get the tool installed.

Leave a Reply

Your email address will not be published. Required fields are marked *