tagline: From openSUSE
 About Go
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.
 Getting Started / Installation
Change the editor to whichever you prefer in the following (vim, kate, emacs)
Note: Only Factory/12.2 milestones currently have Go version 1.0.2+ packages, 12.1 has Go 1.0.2+ available through the update channel. For Tumbleweed, SLES you will need to add the repository at devel:languages:go
zypper in go go-doc go-vim
Important: The Go package includes a shell script to setup the expected environement variable for the Go toolchain. This is installed to /etc/profile.d/go.sh but the variables will not be imported until you either source this file or start a new login session. Either source /etc/profile.d/go.sh or relog to import the vars into your environment. You can check that the environment is setup by checking for the following variables.
: env | grep GO GOBIN=/home/ganderson/go/bin GOROOT=/usr/lib64/go GOOS=linux GOPATH=/home/ganderson/go:/usr/lib64/go/contrib
You may optionally override these locations by editing your .bashrc or .profile, please read the documentation on GOPATH especially if you wish to change these locations, see: go help gopath
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 .bashrc/.profile, set another location or symlink it to ~/bin
If you are unsure of this, please see the following documentation:
Once you have installed the package, 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: http://groups.google.com/group/golang-nuts IRC: #go-nuts on freenode
The go-doc package enables the use of the Godoc reference & API documentation server. You can run the documentation server as a service, (systemctl start godoc.service, port 6060 by default) or you can manually start it, run godoc --help for arguments. The systemd service runs with search indexing enabled so you may wish to use the godoc tool in cli mode or run it manually if you are on a RAM limited system.
Sorry, there are no man pages as yet (work is underway on a tool to convert existing toolchain docs to groff format) but the toolchain, command & api reference, language spec and more are all available either through the godoc tool or directly via http://golang.org
The go-vim package has a plugin :Godoc which integrates with the godoc tool.
You won't find the majority of the toolchain in your PATH, Go programs and source are managed by the "go" tool, see "godoc go" or "go help" for details.
We use the default Go compiler/linker/packer tools, we don't currently have a gccgo offering. You can invoke these tools directly if you so wish, see "go tool", "go help tool".
We have a number of popular/useful packages in devel:languages:go repo, I recommend installing the associated doc package for libraries as it will integrate with the local godoc API server. In addition to these you can browse the community dashboard for additional packages:
If you find something of use that's not in devel:languages:go let us know and we'll bundle it for you, or you can use the Go packaging guide and the .spec recipe from the wiki to package it yourself, SR's welcome.
There are syntax highlighting and editor plugins: The packages are - go-emacs, go-kate (more up to date than current kate part syntax file), go-vim.
There's an up-to-date ctags package with go support in devel:languages:go repo. The "gocode" package from the same repo provides auto-complete support for vim & emacs.
Note that Go embraces a universal code style, use the "go fmt" or "gofmt" tool to aid you with this.