Among modern programming languages Google's Go is really exceptional. Simple, powerful, fast. But there are many other things which make programming in Go a really exciting experience. See for yourself and be prepared for The Awesomeness of Go!
Event: GDG DevFest 2016, 21.11.2016
Speaker: Igor Lankin, inovex GmbH
Mehr Tech-Vorträge: https://www.inovex.de/de/content-pool/vortraege/
6. multicore processors
networked systems
massive computation clusters
tens of millions of lines of code
web programming
see “Go at Google: Language Design in the Service of Software Engineering”
https://talks.golang.org/2009/go_talk-20091030.pdf
6
Why?
The World has Changed
7. slow, clumsy development
poor concurrency support
poor tooling
slow compilation
7
Problems
Languages did not adapt (well)
13. native language with "scripty" feeling
statically typed, object oriented (kinda)
simple, pragmatic, efficient
built for scalability, multiprocessing, networking
13
Awesome Result
Go
14. 14
Examples
package main
import "fmt"
func main() {
sum := 0
for i := 0; i < 10; i++ {
if i%2 == 0 {
fmt.Println(i)
sum += i
}
}
fmt.Println(sum)
}
type Rect struct {
Width, Height int
}
func (r *Rect) Area() int {
return r.Width * r.Height
}
rect := Rect{6, 7}
fmt.Printf(“%v has an area of %dn”, rect, rect.Area())
https://play.golang.org/p/6hCgnBt8se https://play.golang.org/p/VHnwvfY2Wl
15. clean, concise syntax
reduced typing
no stuttering: foo.Foo *myFoo = new foo.Foo(foo.FOO_INIT) //??
flat type system
clear control flow
standardized formatting
15
3. Awesomely Readable
20. fast-growing
open-source libraries, tools, projects
easy to share and reuse:
import "github.com/aws/aws-sdk-go/aws"
docs: godoc.org/github.com/aws/aws-sdk-go/aws
github.com/avelino/awesome-go
golanglibs.com
20
6. Awesome Community
Share all the code
22. inovex GmbH, waipu.tv (eXaring)
Google: Youtube, kubernetes, dl.google.com
Apple, Twitter, docker, Dropbox, SoundCloud, …
github.com/golang/go/wiki/GoUsers
Popular among pythoners, IT-engineers
22
Who is using Go?
Cool Folks Only!
23. ~10-20% faster in v1.7 (amd64)
x% faster in v1.8? (Jan 2017)
compiled, garbage-collected
superior concurrency
=> better CPU utilization
23
8. Awesome Performance
Java < Go < C++
24. The End Of Moors Law
http://philosophyworkout.blogspot.de/2016/01/a-decade-of-economic-stagnation-looms.html
24
25. comprehensible concurrency, that keeps you sane
(mostly)
1. lightweight threads (goroutines)
2. safe communication (channels)
25
9. Awesome for Concurrency
built-in support
32. 32
var ch = make(chan string)
func say(text string, delay int) {
time.Sleep(time.Duration(delay) * time.Second)
ch <- text
}
func consume() {
for {
message := <-ch
fmt.Println(message)
}
}
func main() {
go consume()
go say("let's go!", 3)
go say("ho!", 2)
go say("hey!", 1)
time.Sleep(4 * time.Second)
}
https://play.golang.org/p/WnsLkutrd-
33. 33
goroutines + channels = <3
very powerful concept
easy to use
safe communication
comprehensible concurrency, that keeps you sane
(mostly)
34. pragmatic attitude
remove waste (language, tools, libraries)
keep things small, comprehensible (minimalistic)
lets you focus on the problem
34
10. Awesomely Pragmatic
Keep it simple
35. not only for infrastructure
cool frameworks for web services
small, simple, beautiful
but you can also build complex monoliths, too ;)
35
11. Awesome for Web Services
And more
36. Missing features: generics, thread-safe data structures
May be confusing: slices, nil, pointers, range variable
You need to think differently
Modelling can be tricky
But it still is pretty awesome! ;)
36
Everything Awesome?
"90% Perfect, 100% of the time"
37. welcome/ - A Tour of Go
faq/ - FAQ
doc/effective_go.html - Deep Dive
play.golang.org
gobyexample.com - Examples
37
12. Awesomely Easy to Start
golang.org