Quick stats: ● Version 1 is now 43 43 days days old ● Compiled language ● Faster than Python ● Garbage collection ● Slower* than C *debatable ● Production ready More details: ● Officially announced Nov. 2009 ● BSD license ● Strong, static typing ● Cross-platform
Gets out of your way Execution time Python is really easy to read and write but execution time ins't always the best. Concurrency is available with tools like tornado but is not a “baked in” feature of the language. Python
Execution time To me, Go is as clear and sensible as python but with performance characteristics closer to C. “C for the 21st century” - golang.org Python Gets out of your way
“Before Go, a developer had to choose between fast execution but slow and not efficient building (like C++), efficient compliation (but not so fast execution like .NET or Java), or ease of programming (but slower execution, like the dynamic languages): Go is an attempt to combine all three wishes: efficient and thus fast compilation, fast execution, ease of programming.” – Ivo Balbaert The Way to Go
No headers package main import ( “fmt” “math” ) func main() { fmt.Println(“Hello ひらが” ) fmt.Println(math.Pi) } Each file is part of a package (namespace)
Don't fight it package main import ( “fmt” “math” ) func main() { fmt.Println(“Hello ひらが” ) fmt.Println(math.Pi) } Must have main() function; Takes no arguments
Goroutines and channels Goroutines are lightweight (around 4kb) functions running in the same address space. Not exactly the same as threads, coroutines or processes. func Announce(message string) { go func() { fmt.Println(message) }() } Conceptually similar to the & command in Unix to run a process in the background. Channels are how goroutines “talk” to each other, only one goroutine will ever have access to the data at any given time. c := make(chan int) go func() { list.Sort() c <- 1 }() doSomethingForAWhile() <-c In this example we make a channel of integers, call list.Sort() as a goroutine and when It's done, send the signal to c. We can call other functions while we wait for sort to finish. Once we get the signal, we can discard it.
“web.go web.go is the simplest way to write web applications in the Go programming language. It's ideal for writing simple, performant backend web services. “ https://github.com/hoisie/web • Routing to url handlers based on regular expressions • Secure cookies • Support for fastcgi and scgi • Web applications are compiled to native code. This means very fast execution and page render speed • Efficiently serving static files
Resources - Main site http://golang.org/ - In-browser, guided sandbox http://tour.golang.org - Step by step through samples http://golang.org/doc/codewalk/ - Community pakages http://godashboard.appspot.com/ - Books http://go-lang.cat-v.org/books Bindings for couch, mongo, riak, mysql, redis, even bitcoin.
Who is using Go? - Stathat -- http://blog.golang.org/2011/12/building-stathat-with-go.html - Google Thanksgiving doodle -- http://www.google.com/logos/2011/thanksgiving.html - Heroku - Cannonical - Atlassian - SmugMug Many others at http://go-lang.cat-v.org/