Sunday, December 20, 2009

how-to install go programming language on opensuse

alright, after a few searches on google, i wasn't able to find a proper how-to install guide for golang on opensuse, so i decided to write a step-by-step guide on my own.
why i do that? because on the official how-to installation guide http://golang.org/doc/install.html, the example installation seems to be done with ubuntu or a similiar distro.

  1. set standard go variables
    • export GOROOT=/home/you/golang
    • export GOOS=linux
    • export GOARCH=386

  2. create folder for binaries, set optional variable GOBIN and add to PATH
    • mkdir /home/you/bin
    • export GOBIN=/home/you/bin
    • export PATH=$PATH:/home/you/bin

  3. check golang environment variables and check if GOBIN is added to PATH
    • env|grep '^GO'
    • env|grep '^PATH'

  4. install mercurial
    • sudo zypper install mercurial

  5. check-out the go repository from googlecode
    • hg clone -r release https://go.googlecode.com/hg/$GOROOT

  6. install development environment stuff (can also be done via yast). i had the opensuse dvd at hand, so i installed it from there, if you don't have the dvd, you should be able to find the necessary packages online as well. the required dev-stuff is: gcc, bison parser, make, ed editor, glib2-devel
    • sudo zypper install gcc bison glib2-devel ed make


  7. to build go, you need to have the variable GOBIN in your PATH environment (see step 2) and build it :-)
    • cd $GOROOT/src
    • ./all.bash

  8. when everything is finished you should see the following 2 lines in your shell
    • --- cd test ../test
    • N known Bugs; 0 expected Bugs
    • according to googles official how-to, N varies from release to release
note:
if you run into troubles while building go (step 7) the issue http://code.google.com/p/go/issues/detail?id=178#makechanges might be helpful

i had a building problem, that had to do with my locale management on opensuse, but after reinstalling the locales everything was fine again

i installed the go programming language on a freshly updated opensuse 11.2 release, i guess it should work with older releases as well, but i didn't test it

No comments:

Post a Comment