5. History
Started at Google
Released, open-sourced in 2009
New, modern
20161945
C
1972
Python
1991
Java
JavaScript
1995
Go
2009
https://golang.org/
6. Why Go?
Google internal needs
★ Efficient large scale programming
★ Distributed systems
★ Speed of compilation
★ Multicore, networked hardware
http://xkcd.com/
7. Go is…
Fast compilation time
Concurrent
Garbage-collected
Modern with support for networked and
multi-core computing
General-purpose
Compiled
Statically typed like C, Java
Feels as easy, lightweight as JS, Python
22. Concurrency philosophy
The efficiency of an asynchronous model written in a synchronous style
Connect goroutines with channels -- simpler, maintainable code
23. Tooling
gofmt reformats code
goimports updates import lines
golint prints style mistakes
godoc documentation of packages and symbols
go vet vets the package
go get download and install packages and dependencies
go test automates testing the packages
no more tabs vs. spaces!
no more “import not used”, or “import not found”
26. Go: a general-purpose language
Not just a “systems language”
Unexpected interest from users of scripting languages
Diverse uses across the community
★ Scientific computing
★ Web applications
★ Graphics and sound
★ Network tools
★ … and much more
28. Recap: Go is
Fast compilation time
Concurrent
Garbage-collected
Modern with support for networked and
multi-core computing
General-purpose
Compiled
Statically typed like C, Java
Feels as easy, lightweight as JS, Python
29. What’s next
A Tour of Go tour.golang.org
The Go Playground play.golang.org
Documentation golang.org/doc
Go Wiki github.com/golang/go/wiki
https://golang.org/
Notas do Editor
Description: Go (又稱 Golang) 是 Google 在 2009 年推出的程式語言。go 以好讀、好寫、執行效率高為主打,也很適合拿來開發 web services。除了 Google 之外,許多公司,包括 Uber、Medium、Docker 等也使用 Go 來開發產品。究竟 Go 有什麼魅力?想知道更多,歡迎來參加這次的讀書會!
http://stackshare.io/go/in-stacks
A bit like C
To run it https://play.golang.org/p/eEZMXonMhA
main package: make this program executable (main function is the program entry point)
fmt: a package
Public vs. private
Succinct wording (not as verbose as Java… System.io.println)
Dependency made easy
https://golang.org/doc/code.html
To build & install the program (and its dependencies): $ go install path/to/dir
Then run the binary under $GOPATH/bin/<binary-name>
To test a program compiles: $ go build path/to/dir
To build, install, and run: $ go run path/to/file
Notice that the type comes after the variable name.
Why? https://blog.golang.org/gos-declaration-syntax
Go is statically typed, but type inference saves repetition.
A struct is a type which contains named fields
Go “objects” are just values. There is no “box”.
Attracted by an easy, reliable language that performs well.
Web app: Concurrency, http package, libraries around it
Docker: talking to OS (interface between OS and Go, syscall)