GoGo on openSUSE
16. Apr 2012 | Jos Poortvliet | No License
openSUSE 12.1 was one of the first major Linux distributions to include the new programming language Go. Recently, go 1.0 was released and shortly before milestone 3 openSUSE Factory received packages for this new Go. Graham Anderson notified the factory mailing list of this and included some tips for Go hackers on getting started with Go. Read on for some of his tips and links to more.
GoWhat
According to the description from the go-lang website:
Go is a programming language and environment that makes it easy to build simple, reliable, and efficient software. Go is an expressive, concurrent, garbage collected general/systems programming language that is type safe and memory safe. It has pointers but no pointer arithmetic. Go has fast builds, clean syntax, garbage collection, methods for any type, and run-time reflection. It feels like a dynamic language but has the speed and safety of a static language.
In a discussion on python vs go you’ll find that
Clearly Go is a superior weapon if the goal is to shoot everyone in the foot at the same time. The GIL in python forces you to shoot each person in the foot in sequence :).
(by Kyle Lemons)
In other words, go is optimized for concurrent programming - getting the most out of our modern multi-core systems.
GoGetting
To install go, one can use the new graphical interface at software.opensuse.org by going to software.opensuse.org/package/go. Get the documentation here (go-doc) and if you’re a VIM user, also get go-vim. From a commandline, Factory users can do a simple zypper in go go-doc go-vim
. If you’re on openSUSE 12.1 or other versions you’ll need the devel:languages:go project. Lots of additional stuff there of course. Note that adding go via the software.opensuse.org route will add the devel:languages:go repository to your list, allowing you to pull in any of the extras easily.
GoSetup
You’ll have to know and set a few thingies now:
-
Either source /etc/profile.d/go.sh or open a new terminal to import the Go env vars into your environment. Your $GOPATH will be set to $HOME/go so either override this in your profile or create the directory.
-
Go libraries and packages installed from the openSUSE repo are installed to $GOROOT and the system bindir. Any extra packages or binaries you install using the “go” tool will be installed to $GOPATH and $GOBIN (if it’s set).
-
Currently $GOBIN for non root users defaults to $GOPATH/bin, we currently don’t add that location to your $PATH so you will either have to add it in your profile or set another location for $GOBIN (such as $HOME/bin). See the golang documentation for more information.
GoGo
It’s time to get Going now. An excellent way to check if everything is setup OK is to install and run the Go Tour! If you have a viable Go environment the following two commands will execute without error.
go get code.google.com/p/go-tour/gotour
gotour
When you have a working environment, the following documentation is a great resource for first time Go hackers:
-
For experienced C, C++ and Java hackers I also recommend the Go FAQ.
-
Go language community support: Mailing List and #go-nuts on freenode
GoFun
More information on the current Go setup in openSUSE can be found on this wiki page. Thanks to Graham Anderson for the information there and this article.
If you would like to just play with Go before installing it, there’s a pretty cool tour set up on the golang website: click here to start. You can edit the code and run it live on the site!
Funny images of the go mascotte courtesy of the golang.org website.
Categories: Distribution
Tags: