Slide 1

Slide 1 text

Go

Slide 2

Slide 2 text

Was ist Go?

Slide 3

Slide 3 text

Was ist Go? • Stark, statisch typisiert

Slide 4

Slide 4 text

Was ist Go? • Stark, statisch typisiert • Kompiliert (schnell!) zu Maschinencode

Slide 5

Slide 5 text

Was ist Go? • Stark, statisch typisiert • Kompiliert (schnell!) zu Maschinencode • Garbage collected

Slide 6

Slide 6 text

Was ist Go? • Stark, statisch typisiert • Kompiliert (schnell!) zu Maschinencode • Garbage collected • Concurrency: Goroutinen & Channels

Slide 7

Slide 7 text

Was ist Go? • Stark, statisch typisiert • Kompiliert (schnell!) zu Maschinencode • Garbage collected • Concurrency: Goroutinen & Channels • Simple Sprache, riesige Standard-Lib (Flags, Img)

Slide 8

Slide 8 text

Was ist Go? • Stark, statisch typisiert • Kompiliert (schnell!) zu Maschinencode • Garbage collected • Concurrency: Goroutinen & Channels • Simple Sprache, riesige Standard-Lib (Flags, Img) • OOP

Slide 9

Slide 9 text

Quick look

Slide 10

Slide 10 text

Quick look package main ! import "fmt" ! func main() { fmt.Println("Works") }

Slide 11

Slide 11 text

OOP in Go

Slide 12

Slide 12 text

package main ! import "fmt" ! type Printable interface { PrintName() } ! type A struct { Name string } ! func (a A) PrintName() { fmt.Println("A has name: " + a.Name) } ! type B struct { Name string } ! func (b B) PrintName() { fmt.Println("B has name: " + b.Name) } ! func printSomethingsName(p Printable) { p.PrintName() } ! func main() { A{"John"}.PrintName() printSomethingsName(B{"James"}) }

Slide 13

Slide 13 text

package main ! import "fmt" ! type A struct { ! } ! type B struct { A } ! func (a A) Foo() { fmt.Println("Foo") } ! func main() { B{}.Foo() }

Slide 14

Slide 14 text

Concurrency in Go

Slide 15

Slide 15 text

Concurrency in Go package main ! import ( "fmt" "time" "strconv" ) ! func printSeconds(i int) { time.Sleep(1 * time.Second) fmt.Println(strconv.Itoa(i) + " seconds") } ! func main() { for i:=1; i < 6; i++ { printSeconds(i) } }

Slide 16

Slide 16 text

Concurrency in Go package main ! import ( "fmt" "time" "strconv" ) ! func printSeconds(i int) { time.Sleep(1 * time.Second) fmt.Println(strconv.Itoa(i) + " seconds") } ! func main() { for i:=1; i < 6; i++ { printSeconds(i) } } package main ! import ( "fmt" "time" "strconv" ) ! func printSeconds(i int) { time.Sleep(1 * time.Second) fmt.Println(strconv.Itoa(i) + " seconds") } ! func main() { for i:=1; i < 6; i++ { go printSeconds(i) } time.Sleep(2 * time.Second) }

Slide 17

Slide 17 text

Concurrency in Go package main ! import ( "fmt" "time" "strconv" ) ! func printSeconds(i int) { time.Sleep(1 * time.Second) fmt.Println(strconv.Itoa(i) + " seconds") } ! func main() { for i:=1; i < 6; i++ { go printSeconds(i) } time.Sleep(2 * time.Second) }

Slide 18

Slide 18 text

Concurrency in Go package main ! import ( "fmt" "time" "strconv" ) ! func printSeconds(i int) { time.Sleep(1 * time.Second) fmt.Println(strconv.Itoa(i) + " seconds") } ! func main() { for i:=1; i < 6; i++ { go printSeconds(i) } time.Sleep(2 * time.Second) } package main ! import ( "fmt" "time" "strconv" ) ! func printSeconds(c chan int, i int) { time.Sleep(1 * time.Second) fmt.Println(strconv.Itoa(i) + " seconds") c <- 1 } ! func main() { c := make(chan int) ! for i:=1; i < 6; i++ { go printSeconds(c, i) } ! <- c }

Slide 19

Slide 19 text

Sonstiges

Slide 20

Slide 20 text

package main ! import ( "fmt" "log" "time" e "errors" "math/rand" "net/http" ) ! func multipleReturns() (error, bool) { rand.Seed(time.Now().UTC().UnixNano()) ! if rand.Intn(10) % 2 == 0 { return nil, true } else { return e.New("Failed"), false } } ! func main() { err, _ := multipleReturns() ! if err != nil { log.Fatal(err) } ! fmt.Println("Random number was even! Starting web server...") ! http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { fmt.Fprint(w, "Hello!") }) ! http.ListenAndServe(":4000", nil) }

Slide 21

Slide 21 text

Go tool chain

Slide 22

Slide 22 text

Go tool chain • go build & go run

Slide 23

Slide 23 text

Go tool chain • go build & go run • go get

Slide 24

Slide 24 text

Go tool chain • go build & go run • go get • go fmt

Slide 25

Slide 25 text

Go tool chain • go build & go run • go get • go fmt • go test

Slide 26

Slide 26 text

Go tool chain • go build & go run • go get • go fmt • go test • go tool

Slide 27

Slide 27 text

Go tool chain • go build & go run • go get • go fmt • go test • go tool

Slide 28

Slide 28 text

Go tool chain • go build & go run • go get • go fmt • go test • go tool • go doc

Slide 29

Slide 29 text

Negative Seiten

Slide 30

Slide 30 text

Negative Seiten • go get unterstützt im Moment keine Versionen

Slide 31

Slide 31 text

Negative Seiten • go get unterstützt im Moment keine Versionen • Memory-leaks

Slide 32

Slide 32 text

Negative Seiten • go get unterstützt im Moment keine Versionen • Memory-leaks • Community-Libs leiden unter Node.JS-Effekt

Slide 33

Slide 33 text

Negative Seiten • go get unterstützt im Moment keine Versionen • Memory-leaks • Community-Libs leiden unter Node.JS-Effekt • Keine Generics - bis jetzt

Slide 34

Slide 34 text

Negative Seiten • go get unterstützt im Moment keine Versionen • Memory-leaks • Community-Libs leiden unter Node.JS-Effekt • Keine Generics - bis jetzt • Error-Handling äußerst verbose

Slide 35

Slide 35 text

Negative Seiten • go get unterstützt im Moment keine Versionen • Memory-leaks • Community-Libs leiden unter Node.JS-Effekt • Keine Generics - bis jetzt • Error-Handling äußerst verbose • (Keine Vererbung)

Slide 36

Slide 36 text

Wer nutzt Go?

Slide 37

Slide 37 text

Wer nutzt Go? • Google :)

Slide 38

Slide 38 text

Wer nutzt Go? • Google :) • Shopify

Slide 39

Slide 39 text

Wer nutzt Go? • Google :) • Shopify • Heroku

Slide 40

Slide 40 text

Wer nutzt Go? • Google :) • Shopify • Heroku • Soundcloud

Slide 41

Slide 41 text

Wer nutzt Go? • Google :) • Shopify • Heroku • Soundcloud • Bitly

Slide 42

Slide 42 text

Wer nutzt Go? • Google :) • Shopify • Heroku • Soundcloud • Bitly • Canonical

Slide 43

Slide 43 text

Weitere Informationen

Slide 44

Slide 44 text

Weitere Informationen • http://golang.org

Slide 45

Slide 45 text

Weitere Informationen • http://golang.org • https://groups.google.com/d/forum/golang-nuts

Slide 46

Slide 46 text

Weitere Informationen • http://golang.org • https://groups.google.com/d/forum/golang-nuts • https://github.com/robfig/revel

Slide 47

Slide 47 text

Weitere Informationen • http://golang.org • https://groups.google.com/d/forum/golang-nuts • https://github.com/robfig/revel • https://github.com/limetext/lime

Slide 48

Slide 48 text

Weitere Informationen • http://golang.org • https://groups.google.com/d/forum/golang-nuts • https://github.com/robfig/revel • https://github.com/limetext/lime • https://github.com/dotcloud/docker

Slide 49

Slide 49 text

Weitere Informationen • http://golang.org • https://groups.google.com/d/forum/golang-nuts • https://github.com/robfig/revel • https://github.com/limetext/lime • https://github.com/dotcloud/docker • https://github.com/mitchellh/packer

Slide 50

Slide 50 text

Danke für’s Zuhören. Fragen?