Google's Go programming language

I've been looking at Google's Go programming language on and off for the last week or so, and though I won't be using it any time soon, it looks like an interesting new language.

In a world full of programming languages, you might wonder why Google programmers have decided to create yet another programming language. The Go programming language authors answer this question in their FAQ:

Go was born out of frustration with existing languages and environments for systems programming. Programming had become too difficult and the choice of languages was partly to blame. One had to choose either efficient compilation, efficient execution, or ease of programming; all three were not available in the same mainstream language. Programmers who could were choosing ease over safety and efficiency by moving to dynamically typed languages such as Python and JavaScript rather than C++ or, to a lesser extent, Java.

Go is an attempt to combine the ease of programming of an interpreted, dynamically typed language with the efficiency and safety of a statically typed, compiled language. It also aims to be modern, with support for networked and multicore computing. Finally, it is intended to be fast: it should take at most a few seconds to build a large executable on a single computer. To meet these goals required addressing a number of linguistic issues: an expressive but lightweight type system; concurrency and garbage collection; rigid dependency specification; and so on. These cannot be addressed well by libraries or tools; a new language was called for.

One of the key phrases here for me is "systems programming", meaning that this language is intended for things like operating systems and utilities, as opposed to "applications programming", which focus on things like databases and user interfaces.

Hello, world in Go

You can get an idea of the Go programming language syntax by looking at their tutorial examples. For instance, their "Hello, world" Go program looks like this:

package main

import fmt "fmt"  // Package implementing formatted I/O.

func main() {
    fmt.Printf("Hello, world")
}

They also share a version of the traditional Unix echo utility:

package main

import (
    "os"
    "flag"  // command line option parser
)

var omitNewline = flag.Bool("n", false, "don't print final newline")

const (
    Space = " "
    Newline = "\n"
)

func main() {
    flag.Parse()   // Scans the arg list and sets up flags
    var s string = ""
    for i := 0; i < flag.NArg(); i++ {
        if i > 0 {
            s += Space
        }
        s += flag.Arg(i)
    }
    if !*omitNewline {
        s += Newline
    }
    os.Stdout.WriteString(s)
}

While I have great respect for the Go programming language authors, Go isn't my cup of tea, and I don't anticipate looking at it again any time soon.

However, before leaving, I thought I'd share links to a few Go programming language resources:

I found the Go Language Design FAQ to be a really good read. While I won't be using Go, the authors clearly state their reasoning for creating a new language, and their design goals.

As a final note, I think it would be very humorous of them to change the name of the language from Go to either GoTo, or Goo, but I don't see either of those happening any time soon. :)