SDB:Go
Go
About Go
Go is a programming language and environment (designed by Robert Griesemer, Rob Pike and Ken Thompson) 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.
Getting Started / Installation
Note: Leap and SLES only ship with slightly older versions of Go. If you intend to compile Go software requiring a newer version of the Go compiler on these distributions, you will need to add the repository at devel:languages:go. Tumbleweed generally ships a recent version in the Factory repository.
To install the Go compiler, issue:
zypper in go go-doc
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, see: go help gopath and http://golang.org/doc/code.html#GOPATH).
Note that the $GOBIN directory may not be present in your users $PATH environment variable by default. To launch Go binaries installed outside of the system's package manager, i.e. ones installed directly using the "go" tool, either launch them by specifying the full path, or add the $GOBIN directory to your $PATH variable. The default location for local installations is is /home/$USER/go/bin and can be added to $PATH using an entry in the ~/.profile file:
PATH=$PATH:/home/$USER/go/bin
Once you have installed the "go" 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 golang.org/x/tour tour
When you have a working environment, the following documentation is a great resource for first time Go hackers:
http://golang.org/doc/install#next
For experienced C, C++ and Java hackers I also recommend the Go FAQ.
http://golang.org/doc/go_faq.html
Support
Project homepage:
http://golang.org
Go language community support:
Mailing List: http://groups.google.com/group/golang-nuts IRC: #go-nuts on Libera.Chat
Documentation
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.
Toolchain
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".
Packages
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:
http://godashboard.appspot.com/project
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.
http://en.opensuse.org/openSUSE:Packaging_Go
Editors
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.