An Introduction to the Go Language: Boldly Going Where No Man Has Ever Gone Before


The Go Programming Language (Go) is an open-source programming language sponsored by Google and created by Robert Griesemer, Rob Pike, and Ken Thompson that aims to simplify systems programming and to make programming fun again. This article aims to introduce developers to Go and give them enough information to try it out for themselves.

Go is a relatively new language that is in constant development but it already has a considerable amount of industry support and is used in real systems at Google.

The notion of yet another programming language may seem weird to some people. But Go does bring something new to the table and its fundamental design principles make it different enough (and arguably, better enough) to justify its existence.

Hello World!

No introduction to any language is complete without the canonical Hello World program:

package main

import "fmt"

func main() {

    fmt.Println("Hello world!")


The program defines a new package (main is always the package that contains the main function) then imports the input/output formatting package (fmt), defines its main function (which is the program’s entry point), and uses the Println function from the fmt package to print the string Hello world!.

Why Go?

Go has several features that make it unique and attractive. Here is a non-exhaustive list:

  • Although it is compiled, Go is also a garbage-collected language. This puts less pressure on the developer to do memory management, as the language itself takes care of most of the grunt work needed. In this respect, it is similar to Java, as opposed to C++.
  • Go has built-in concurrency, which allows parallelism in an easier way than is possible in other languages. Go has the concept of goroutines to start concurrent work and the concept of channels to permit both communication and synchronization.
  • Go is a statically-typed language (which makes code more robust as several possible bugs can be detected during compilation) that supports duck-typing (types can satisfy interfaces and be passed in to any functions/methods that accept those interfaces). Go also has type inference, which means you do not need to explicitly mention a variable type whenever it can be inferred by the compiler.

Installing Go

Go can be downloaded from the project page and there are pre-packaged versions for several platforms (Linux, FreeBSD, Windows, MacOS) and architectures (ARM, x86, x64). Full instructions can be found here.

As it is open-source, you can also download its source code and compile it yourself.

Go by Example

From all of the things mentioned above, it should be evident to would-be Go programmers that concurrency support is deeply integrated in the language. This helps making concurrent programming a lot easier. Consider this example from a recent Go talk:

package main

type Ball struct{ hits int }

func main() {

   table := make(chan *Ball)

   go player("ping", table)

   go player("pong", table)

   table <- new(Ball) // game on; toss the ball

   time.Sleep(1 * time.Second)

   <-table // game over; grab the ball


func player(name string, table chan *Ball) {

   for {

     ball := <-table


     fmt.Println(name, ball.hits)

     time.Sleep(100 * time.Millisecond)

     table <- ball



You can run it by yourself and play with it here.

This programs defines a channel (table), starts two players concurrently (“ping” and “pong”), and then starts the game by sending a ball to the table.

Each player tries to grab the ball from the table; only one succeeds. The player that grabbed the ball increments the hit count and sends it back to the table. The other player then grabs it and does the same. This repeats for 100 milliseconds when the main routine grabs the ball again and the program terminates.

Go’s Future

Recently Go 1.1 was released. This version brought significant performance improvements.

Although Go is in constant development, the existing API is stable and guaranteed not to break in any meaningful way throughout all Go 1.x releases. This gives developers a stable platform to work on, which is specially important for large scale projects.

Go is a great language that is improving fast and that showed it can be used for all project sizes. There is already a lot of open-source third-party code that can be used to complete the most varied tasks and a sizeable community to help with all kinds of questions.

Obviously, I’m a fan. Together with everything else mentioned here, Go is definitely an option that you should consider.

See also:


  1. Jessica Darko says:

    Go does not have “concurrency” or “parallelism”. It is a terrible attempt at solving these issues, especially considering that erlang solved them correctly over 20 years ago.

    It’s sad that so many so-called “engineers” arent’ willing to put in a little effort to learn erlang and thus produce correctly engineered results, but would rather take something that seems like no-effort and use Go and get a program that doesn’t actually work.

    You cannot do concurrency or parallelism correctly in go. It simply isn’t possible with a shared memory architecture (and lacking the other fundamentals of erlang)

    Anyone who thinks otherwise is incompetent.

    Go didn’t have to be this way– building a new language they could have done it right, but the people at Google are incompetent as well.

    And a sure sign that we have people choosing languages based on fashion rather than competency is that the first response to this is going to be a sneering one claiming that it’s asinine to say google is incompetent (Because incompetent programmers worship google and don’t know the difference between enginering and a stupid company worshiping ideology.)

    Anyway, shame on you.

    • Jesus Christ lady, it’s just a language.

    • Seems like you’ll make a really good dictator, have you considered a career change?

    • This post is just you shouting, “My old thing is better than your new thing!” over and over. How about you come back and and some technical details and examples of Go programs that don’t “actually work”.

    • I am as much a fan of Erlang as the
      next person and have written a couple non-trivial applications on top
      of it that work and behave as I intended. Like you, I am inclined to
      believe that it solves the issues of concurrency in a well balanced
      way, providing the right abstractions and metaphors to reason about
      dataflow in a complex systems.

      That said, writing off an entire chunk
      of the developer population as “incompetent” does little to drive
      the conversation forward in a meaningful way. The majority of your
      post is composed of ad hominem attacks and fallacious appeals to
      authority, giving little evidence of any truth in your backing.
      Aside from that, you do little to actually support your assertion of
      Erlang’s capabilities, outside of a hand wavy mentioning of shared
      state without validation.

      Is it too much to ask that we leave
      rhetoric at home and engage in a well reasoned debate on the pros and
      cons of a given language? I personally find Go to be less
      interesting than other languages and, while it doesn’t particularly
      interest me, it’s sloppy to dismiss it out of hand without weighing
      it on its own merits.

    • Bruno Albuquerque says:

      Hi Jessica.

      it seems you have pretty string opinions about every single language in the world versus Erlang. I am particularly of the opinion that Go is a pretty good language but the best programing language will always be the one you are more confortable with. A programming language is a simply a tool and is not an end on itself.

      That being said, your assertion that Go does not have concurrency or parallelism is simply not true. Based on this assertion alone I wonder if you actually tried to use the language or is just refusing to use enything that is not Erlang.

      One of the tenets of Go programming is “Do not communicate by sharing memory; instead, share memory by communicating” which at least partially addresses your concern about “shared memory architecture”.

      An interesting read:

      But what do I know? I am incopetent, it seems (at least based on your definition of incompetence).

    • Yngvar Kristiansen says:

      Nobody can take what you say to be valid, as you don’t have any sources nor proove anything.

    • Go’s current version is 1.5 right now. Has any of you angry birds tried it out yet?

  2. Bruno Albuquerque says:

    While we are at it, I just discovered Python also has a web server (I never used it, so I do not know how complete it is) on its standard library. Living and learning. 🙂

  3. Sorry, fail to see any compelling reasons to invest in Go, unless I decide to become a Google imp in the future.

    Why Go:

    1- it is fast: So what? any compiling lang is. about the build time: faster than D? even in c++ you can use precompiled headers, making casual rebuild in 1sec or parallel build for a huge proj.

    2- garbage collection is not a plus! it is a disadvantage that a language is not allowing for direct memory management.

    3- as far one model fits all 🙁 I doubt it will be ‘optimal’ for many situations, where indeed it is critical to have concurrency. Erlang is also 1 model fit all, take the message passing or leave it 🙂 thats not a ‘correct’ solution, it is simply one solution!

    4 – nothing unique about string typing and having ducktyping. take any dynamic language with strong-type support!

    5 – I prefer less comments/doc more clear code!

    6 – built-in web server 🙂 on this one I will leave it with a smile 🙂 Indeed it is nice, but very questionable why not simply use lib/framework for something that has nothing to do with language design to start with 🙂

    7 – CMAKE & Jenkins is good enough.

    • Bruno Albuquerque says:

      Let me try to address your comments:

      1 – Did you actually try Go? Compilation times are orders of magnitude faster than a comparable C++ project. With or without pre-compiled headers. Let me show you a concrete example:

      bga@librarian:~/go-dev/src/$ time go build main.go

      real 0m1.193s
      user 0m1.160s
      sys 0m0.200s

      goweb is a web framework for Go. It has lots of dependencies and all of them got built when I ran the command line above. That’s roughly 15000 lines of code. Even on my very underpowered ARM NAS, it gets build in 8 seconds.

      2 – I guess that is a matter of preference. There are advantages and disadvantages of using a garbage collector. For most programmers, having it is actually a plus.

      3 – Where did I say that one model fits all?

      4 – Each feature taken isolated will obviously end up being matched in some other language. The fact that they are all in the same lamnguage is what matters.

      5 – Having an easy way to document programs does not make the code less clear, so this is a moot point.

      6 – That’s not part of the language, it is part of its standard library. Having a rich standard library helps programmers get the job done without having to hunt for specific things.

      7 – I believe that it is true in your opinion. But I really think you should try Go first before reaching to conclusions like that.

      Other than that, programming languages are simply tools.They are a means to an end and not an end in itself. If is fine to prefer one language over the other but I do not think it is fine to rule out any language without trying it first..

      • 1- not interested

        2- I’m not against GC. I’m against GC only! Go,C#,Java etc.Hint, D language is way more interesting than Go in that respect giving you the best of both world.

        3- it was both comment for Erlang&Go where concurrency is “build in” but usually it is one realization fit all ! e.g. message passing for comm.

        4- true! but again is it unique to Go?

        5- NO! but it makes it bloated! e.g. #region in c#

        6- Again! how different is then from I must say almost all the rest?

        7- true! but which one first..? D, Go, Ada, LuaJIT … damn they are all good 🙂 yet none will replace C/C++ ,cause it is not merit only. if popularity of lang. was merit only, JavaScript should had never met a daylight 😉

        Agree! You can learn something from any language! without exceptions, even JS 😛
        but one can not spend 100% of its time on 100% of the languages. one needs to learn to discriminate on the fly and prioritize accordingly. I’am into compiled lang, but unfortunately Go is just after D and Ada on the list. Mainly because I fail to see a killer feature, in contrast to D,Ada. Considering the fact I can hardly focus on more than 1 , Go is left in my periphery for now.

        after all, it is MHO
        p.s. no offense

        • Bruno Albuquerque says:

          Well, you can obviously decide what language to use or not, but judging a language and giving an opinion about it whithout really trying to use it does not make any sense. So i guess this discussion won’t really go anywhere and we will have to agree to disagree.

        • The common mistake when approaching Go is to assume that it’s supposed to be appropriate for all domains for which one would use C++. It’s not. It’s appropriate for those tasks for which a garbage-collecting, task-scheduling runtime is desired, and for which rapid iteration is more important than raw performance.

          Some other strong bonuses for Go are its excellent ecosystem (go get, go build, go install,,, etc) and its simple feature set (many from the C++/D/Rust camp can’t seem to appreciate that fewer features might be desirable; if you’re one of these people, I’m not sure I can help you) and syntax.

          Basically, Go makes writing application-layer code much easier than traditional systems languages, and much safer/more-performant than scripting languages. And it makes concurrency much nicer than either of the alternatives.

    • > So what? any compiling lang is.
      > take any dynamic language with strong-type support

      And just how many dynamically, strongly typed compiled languages are you familiar with? You’re missing the point that Go combines good features from many different types of languages.

      >garbage collection is not a plus! it is a disadvantage that a language is
      >not allowing for direct memory management.
      >I prefer less comments/doc

      Now just tell me that type inference is either impossible or a fad and you could be a Delphi programmer….

      Memory management is deterministic… delete something that’s no longer being referenced, otherwise don’t. The only thing a programmer can do manually is screw it up.

    • > CMAKE & Jenkins is good enough

      These sorts of statements are puzzling. CMake is a build system that facilitates a superset of the functionality available in the `go` build tool. It’s also insanely complex, inconsistent, and generally hard to learn and use. Using CMake is bringing a nuke to a knife fight; you should say, “The Go tool is sufficient”.

  4. onjoFilms says:

    Looks like ‘C’ to me.

  5. This thread is a microcosm of what is wrong with the software development industry

  6. Leslie Cecile Brown says:

    Thanks, great article, but I am new to this technology and some parts were a little too technical, can anyone point me to a high-level overview of the subject?

Speak Your Mind