Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Introduction to The Go Programming Language

Introduction to The Go Programming Language

A quick look at Go and what makes it special.

Icons: @iconmonstr
Photos: http://peterhellberg.vsco.co/

Peter Hellberg

October 25, 2013
Tweet

More Decks by Peter Hellberg

Other Decks in Programming

Transcript

  1. Introduction to
    The Go Programming
    Language

    View Slide

  2. @peterhellberg

    View Slide

  3. September
    21, 2007

    View Slide

  4. March
    28, 20

    View Slide

  5. Go 1

    View Slide

  6. What is Go?

    View Slide

  7. Go is about composition,
    concurrency, and gophers.
    !
    Keep that in mind.

    View Slide

  8. Composition

    View Slide

  9. Go is Object Oriented,
    but: - NO classes
    - NO subtype inheritance
    - Interfaces are
    satisfied implicitly

    View Slide

  10. View Slide

  11. A statically-typed
    language with syntax
    loosely derived from
    that ofC

    View Slide

  12. Concise variable
    declaration and
    initialization through
    type inference
    (x := 0 not int x = 0)

    View Slide

  13. Built-in concurrency
    primitives: - goroutines
    - channels
    - select

    View Slide

  14. CSP
    http://en.wikipedia.org/wiki/Communicating_sequential_processes

    View Slide

  15. View Slide

  16. A fully garbage
    collected
    language With complete
    control over
    memory layout.

    View Slide

  17. Compilation
    Cross c

    View Slide

  18. Native machine
    code (32-bit and
    64-bit x86, ARM)

    View Slide

  19. View Slide

  20. View Slide

  21. ‘Batteries included’
    standard library

    View Slide

  22. net
    archive
    database
    crypto
    encoding
    unicode
    compress

    View Slide

  23. View Slide

  24. View Slide

  25. Hello World!

    View Slide

  26. package main
    !
    import “fmt"
    !
    func main() {
    fmt.Println(“Hello World!”)
    }

    View Slide

  27. Hello World!
    delivered over HTTP

    View Slide

  28. package main
    !
    import (
    “fmt"
    “net/http"
    )
    !
    func main() {
    http.HandleFunc(“/",
    func(w http.ResponseWriter, r *http.Request) {
    fmt.Fprintln(w, “Hello", r.URL.Path[1:])
    })
    !
    http.ListenAndServe(“:8080", nil)
    }

    View Slide

  29. curl http://:8080/World!
    go run hello_server.go

    View Slide

  30. 25
    50
    75
    100
    Oct 09 Oct 10 Oct 11 Oct 12 Oct 13
    Popularity
    Numbers represent search interest relative to the highest point on the chart.

    View Slide

  31. – gobyexample.com
    cAB Reading material BDa
    – learnxinyminutes.com/docs/go
    – golang.org/doc

    View Slide