Go is the 3 years old open source programming language from Google, and only the “Google” word makes it interesting.
Go-GTK are the Go bindings to GTK from Mattn.
WHATS
I will borrow Wikipedia infos.
Go is a compiled, garbage-collected, concurrent programming language developed by Google Inc.
The initial design of Go was started in September 2007 by Robert Griesemer, Rob Pike, and Ken Thompson. Go was officially announced in November 2009. In May 2010, Rob Pike publicly stated that Go was being used “for real stuff” at Google. Go’s “gc” compiler targets the Linux, Mac OS X, FreeBSD, OpenBSD, Plan 9, and Microsoft Windows operating systems and the i386, amd64, and ARMprocessor architectures.
Goals
Go aims to provide the efficiency of a statically typed compiled language with the ease of programming of a dynamic language. Other goals include:
- Safety: Type-safe and memory-safe.
- Good support for concurrency and communication.
- Efficient, latency-free garbage collection.
- High-speed compilation.
Go Introduction
After this 35min video introduction you can start programming in Go, if you have a previous experience to any programming language, although syntax is close to C. Of course there is a high quality documentation that applies in all Google API’s.
You can try the online editor at tour.golang.org while the official site is at http://golang.org/.
Quick Installation
I am not sure if all distros ship Go Lang compiler, but it isn’t big deal as Google offers binary packages and you can have the latest versions this way.
Get Go @ http://code.google.com/p/go/downloads/list
Or alternative you can download from sources.
$ hg clone https://code.google.com/p/go/
hg is the Mercurial source code management system and you can install it in your distro by:
$ sudo yum/dnf/apt-get/whatever-else install hg or mercurial
I am not going to build Go, and I will just show how to use the binaries.
User Specif Installation
Download the package and extract it (ie $HOME)
Open you .bash_profile and add
export GOROOT=$HOME/go export PATH=$PATH:$GOROOT/bin
Open a new terminal and type “go” to make sure it is working.
System Wide Installation
Download the package and extract it at /usr/local/go
$ sudo tar -C /usr/local -xzf go1.0.3.linux-amd64.tar.gz
Edit your /etc/profile or better make a new profile (ie /etc/profiles.d/go.sh) and add
export PATH=$PATH:/usr/local/go/bin
Source the /etc/profile
$ source /etc/profile
Type in terminal “go” to make sure it is working.
Testing Installation
Then write the typical “Hello World” program to test you installation.
$ gedit hello.go
package main
import "fmt"
func main() {
fmt.Printf("hello, world\n")
}
Run it by
$ go run hello.go hello, world
Please check the official installation documentation that is included into the tarballs, for more. This was just a quick getting started guide!
Go and Android
Go and Android are both from Google. While you can compile and run Go in Android, at this time there isn’t an Go SDK. So Go for now isn’t a replacement or an alternative for JAVA, but hopefully will be in future.
Where Go
According to Google’s Go Blog:
We use Go at Google in a variety of ways, many of them invisible to the outside world. A few visible ones include serving Chrome and other downloads, scaling MySQL database at YouTube, and of course running the Go home page on App Engine. Last year’s Thanksgiving Doodle and the recent Jam with Chrome site are also served by Go programs.
Other companies and projects are using Go too, including BBC Worldwide, Canonical,CloudFlare, Heroku, Novartis, SoundCloud, SmugMug, StatHat, Tinkercad, and many others.
Go-GTK
I randomly found that project in Github https://github.com/mattn/go-gtk. It has a good activity; if hadn’t I wouldn’t post for it. The bindings to GTK are just 36% complete, but hopefully support following widgets and methods enough to run general application.
Main Loop and Events : 26% ( 7/ 26) GtkAccelGroup : 10% ( 2/ 19) GtkAccelMap : 0% ( 0/ 14) GtkClipboard : 23% ( 7/ 30) Drag and Drop : 11% ( 4/ 35) GtkIconTheme : 0% ( 0/ 31) GtkStockItem : 66% ( 4/ 6) Themeable Stock Images : 0% ( 0/ 41) Resource Files : 0% ( 0/ 28) GtkSettings : 23% ( 3/ 13) GtkBinding : 0% ( 0/ 14) Graphics Contexts : 0% ( 0/ 2) GtkStyle : 0% ( 0/ 64) Selections : 8% ( 4/ 47) Version Information : 0% ( 0/ 6) Testing : 0% ( 0/ 16) Filesystem Utilities : 0% ( 0/ 7) GtkDialog : 45% ( 9/ 20) GtkMessageDialog : 62% ( 5/ 8) GtkWindow : 36% ( 38/103) GtkWindowGroup : 0% ( 0/ 5) GtkAboutDialog : 90% ( 29/ 32) GtkAssistant : 91% ( 21/ 23) GtkOffscreenWindow : 0% ( 0/ 3) GtkAccelLabel : 83% ( 5/ 6) GtkImage : 29% ( 9/ 31) GtkLabel : 86% ( 39/ 45) GtkProgressBar : 83% ( 10/ 12) GtkStatusbar : 77% ( 7/ 9) GtkInfoBar : 100% ( 12/ 12) GtkStatusIcon : 68% ( 26/ 38) GtkSpinner : 0% ( 0/ 3) GtkButton : 85% ( 23/ 27) GtkCheckButton : 100% ( 3/ 3) GtkRadioButton : 100% ( 8/ 8) GtkToggleButton : 100% ( 9/ 9) GtkLinkButton : 75% ( 6/ 8) GtkScaleButton : 0% ( 0/ 9) GtkVolumeButton : 0% ( 0/ 1) GtkEntry : 41% ( 26/ 63) GtkEntryBuffer : 72% ( 8/ 11) GtkEntryCompletion : 96% ( 24/ 25) GtkHScale : 100% ( 2/ 2) GtkVScale : 100% ( 2/ 2) GtkSpinButton : 100% ( 30/ 30) GtkEditable : 100% ( 13/ 13) GtkTextIter : 20% ( 19/ 91) GtkTextMark : 0% ( 0/ 7) GtkTextBuffer : 67% ( 52/ 77) GtkTextTag : 75% ( 3/ 4) GtkTextAttributes : 100% ( 5/ 5) GtkTextTagTable : 83% ( 5/ 6) GtkTextView : 28% ( 18/ 64) GtkTreePath : 84% ( 16/ 19) GtkTreeRowReference : 0% ( 0/ 10) GtkTreeIter : 100% ( 1/ 1) GtkTreeModel : 57% ( 15/ 26) GtkTreeSelection : 75% ( 15/ 20) GtkTreeViewColumn : 61% ( 33/ 54) GtkTreeView : 14% ( 14/ 97) GtkTreeView drag-and-drop : 0% ( 0/ 7) GtkCellView : 0% ( 0/ 11) GtkIconView : 17% ( 11/ 62) GtkTreeSortable : 0% ( 0/ 6) GtkTreeModelSort : 0% ( 0/ 9) GtkTreeModelFilter : 0% ( 0/ 11) GtkCellLayout : 0% ( 0/ 9) GtkCellRenderer : 100% ( 2/ 2) GtkCellEditable : 0% ( 0/ 3) GtkCellRendererAccel : 100% ( 1/ 1) GtkCellRendererCombo : 100% ( 1/ 1) GtkCellRendererPixbuf : 100% ( 1/ 1) GtkCellRendererProgress : 100% ( 1/ 1) GtkCellRendererSpin : 100% ( 1/ 1) GtkCellRendererText : 100% ( 2/ 2) GtkCellRendererToggle : 100% ( 7/ 7) GtkCellRendererSpinner : 100% ( 1/ 1) GtkListStore : 83% ( 15/ 18) GtkTreeStore : 80% ( 17/ 21) GtkComboBox : 78% ( 30/ 38) GtkComboBoxText : 100% ( 7/ 7) GtkComboBoxEntry : 80% ( 4/ 5) GtkMenu : 50% ( 15/ 30) GtkMenuBar : 100% ( 8/ 8) GtkMenuItem : 78% ( 15/ 19) GtkImageMenuItem : 0% ( 0/ 11) GtkRadioMenuItem : 44% ( 4/ 9) GtkCheckMenuItem : 100% ( 10/ 10) GtkSeparatorMenuItem : 100% ( 1/ 1) GtkTearoffMenuItem : 100% ( 1/ 1) GtkToolShell : 0% ( 0/ 9) GtkToolbar : 8% ( 3/ 34) GtkToolItem : 3% ( 1/ 30) GtkToolPalette : 0% ( 0/ 22) GtkToolItemGroup : 0% ( 0/ 17) GtkSeparatorToolItem : 0% ( 0/ 3) GtkToolButton : 14% ( 2/ 14) GtkMenuToolButton : 0% ( 0/ 7) GtkToggleToolButton : 0% ( 0/ 4) GtkRadioToolButton : 0% ( 0/ 6) GtkUIManager : 0% ( 0/ 17) GtkActionGroup : 0% ( 0/ 20) GtkAction : 0% ( 0/ 46) GtkToggleAction : 0% ( 0/ 6) GtkRadioAction : 0% ( 0/ 5) GtkRecentAction : 0% ( 0/ 4) GtkActivatable : 0% ( 0/ 6) GtkColorButton : 0% ( 0/ 10) GtkColorSelectionDialog : 0% ( 0/ 2) GtkColorSelection : 0% ( 0/ 21) GtkHSV : 0% ( 0/ 8) GtkFileChooser : 22% ( 13/ 58) GtkFileChooserButton : 18% ( 2/ 11) GtkFileChooserDialog : 100% ( 1/ 1) GtkFileChooserWidget : 50% ( 1/ 2) GtkFileFilter : 55% ( 5/ 9) GtkFontButton : 71% ( 10/ 14) GtkFontSelection : 0% ( 0/ 14) GtkFontSelectionDialog : 37% ( 3/ 8) GtkInputDialog : 0% ( 0/ 1) GtkAlignment : 100% ( 4/ 4) GtkAspectFrame : 0% ( 0/ 2) GtkHBox : 100% ( 1/ 1) GtkVBox : 100% ( 1/ 1) GtkHButtonBox : 0% ( 0/ 5) GtkVButtonBox : 0% ( 0/ 5) GtkFixed : 100% ( 5/ 5) GtkHPaned : 100% ( 1/ 1) GtkVPaned : 100% ( 1/ 1) GtkLayout : 0% ( 0/ 12) GtkNotebook : 90% ( 50/ 55) GtkTable : 93% ( 14/ 15) GtkExpander : 87% ( 14/ 16) GtkOrientable : 0% ( 0/ 2) GtkFrame : 100% ( 9/ 9) GtkHSeparator : 100% ( 1/ 1) GtkVSeparator : 100% ( 1/ 1) GtkHScrollbar : 0% ( 0/ 1) GtkVScrollbar : 0% ( 0/ 1) GtkScrolledWindow : 86% ( 13/ 15) GtkPrintOperation : 13% ( 5/ 36) GtkPrintContext : 18% ( 2/ 11) GtkPrintSettings : 0% ( 0/ 74) GtkPageSetup : 0% ( 0/ 25) GtkPaperSize : 0% ( 0/ 21) GtkPrinter : 0% ( 0/ 23) GtkPrintJob : 0% ( 0/ 10) GtkPrintUnixDialog : 0% ( 0/ 18) GtkPageSetupUnixDialog : 0% ( 0/ 5) GtkAdjustment : 82% ( 14/ 17) GtkArrow : 0% ( 0/ 2) GtkCalendar : 0% ( 0/ 17) GtkDrawingArea : 100% ( 2/ 2) GtkEventBox : 20% ( 1/ 5) GtkHandleBox : 0% ( 0/ 8) GtkIMContextSimple : 0% ( 0/ 2) GtkIMMulticontext : 0% ( 0/ 4) GtkSizeGroup : 100% ( 8/ 8) GtkTooltip : 60% ( 6/ 10) GtkViewport : 100% ( 9/ 9) GtkAccessible : 100% ( 3/ 3) GtkBin : 100% ( 1/ 1) GtkBox : 100% ( 11/ 11) GtkButtonBox : 0% ( 0/ 10) GtkContainer : 18% ( 6/ 33) GtkItem : 100% ( 3/ 3) GtkMenuShell : 0% ( 0/ 11) GtkMisc : 0% ( 0/ 4) GtkObject : 100% ( 0/ 0) GtkPaned : 88% ( 8/ 9) GtkRange : 53% ( 16/ 30) GtkScale : 90% ( 9/ 10) GtkSeparator : 100% ( 0/ 0) GtkWidget : 51% ( 94/184) GtkIMContext : 0% ( 0/ 11) GtkPlug : 0% ( 0/ 7) GtkSocket : 0% ( 0/ 5) GtkRecentManager : 0% ( 0/ 37) GtkRecentChooser : 0% ( 0/ 33) GtkRecentChooserDialog : 0% ( 0/ 2) GtkRecentChooserMenu : 0% ( 0/ 4) GtkRecentChooserWidget : 0% ( 0/ 2) GtkRecentFilter : 0% ( 0/ 12) GtkBuildable : 0% ( 0/ 10) Total progress : 36% (1107/3068)
The above list is autogenerated by “tools/gogtkinfo” and it might be old, as I couldn’t compile it in Fedora 18 and test it my self (maybe doesn’t support GTK3). I let an issue in their GitHub and If I manage to run it, I will try it with some basic GTK Windows.
However it seems it works in older GTK versions.

Go bindings for GTK is something non the less interesting. You can see all GTK’s bindings at gtk.org/language-bindings.php, but be careful to check activity on them. Some are just dead! No matter the GTK thing, I guess it is a worth to have a look at Go Lang, maybe it will become more popular in the next year. Is Google after all ;)
