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

Going with Go

Going with Go

Introduction to the Go language (golang), what makes using Go one of the best options today, some interesting statistics, who's using Go, key features, pointers to resources for learning. The demos done in the live session also included an introduction to a few Go tools.

Avatar for Ravishankar Rajagopalan

Ravishankar Rajagopalan

March 18, 2017

Other Decks in Programming

Transcript

  1. Who uses GO • Google (Youtube and Gmail run on

    GO), Docker (written in GO), Uber (check out https://eng.uber.com/go-geofence/), Dropbox, Facebook, Netflix, eBay, IBM, Digital Ocean, Arista Networks, BBC Worldwide, New York Times, Adjust, Basecamp, BBC, Bit.ly, Bitbucket, Buzzfeed, Booking.com, Brightcove, CloudFlare, CoreOS, DailyMotion, DigitalOcean, Dell, Docker, DropBox, Copyright (c) 2017
  2. And • GitHub, GrayMeta, eBay, Embedly, GOV.UK, Intel, Medium, Monzo,

    Outdoorsy, Pivotal, Slackline, SoundCloud, Segment, SendGrid, SongKick, SpaceX, Trenìt!, Twitch, Yahoo…. …Got bored typing ! Copyright (c) 2017
  3. • Google's Go beats Java, C, Python to programming language

    of the year crown – Tiobe Index Rankings, Jan 2017 Source: http://www.zdnet.com/article/googles-go-beats-java-c-python-to-programming-language-of- the-year-crown/ Copyright (c) 2017 Google's Go is the programming language of the year, according to the long-running Tiobe Index, a search based ranking that gauges the popularity of top and emerging languages among developers.
  4. Where did it start ? • From Google engineers •

    Huge programs/server side software running on cloud • languages that we’ve been using, typically C++ & Java, don’t give us the fluidity and ease of construction Copyright (c) 2017
  5. Needs • Large Programs • High efficiency • Good tooling

    • Language that works well in the modern computing environment • Efficiently run on tens & thousands of machines Copyright (c) 2017
  6. Needs • Language that understands current computing landscape • Networking

    speeds • More cluster computing • Storage/Data access Copyright (c) 2017
  7. Introduction “Go is an open source programming language that makes

    it easy to build simple, reliable, and efficient software” – golang.org Copyright (c) 2017
  8. Designers Copyright (c) 2017 • Ken Thompson (B, C, Unix,

    UTF-8, Regex) • Rob Pike (Unix, UTF-8) • Robert Griesemer (V8 Javascript Engine, Java Hotspot VM) • And other engineers at Google
  9. Introduction • Conceived by Ken Thomson, Rob Pike and Robert

    Griesemer in 2007 • Goal of the language : expressive, efficient in both compilation and execution and effective in writing reliable & robust programs • Concurrent, efficient data abstraction, OO, Garbage collection Copyright (c) 2017
  10. …Introduction • Quick development & type safety • Fast build

    times ! • Compiled code runs close to the speed of C • Fast, productive & fun :) Copyright (c) 2017
  11. …Introduction • “Go is a great language for systems programming

    with support for multi- processing, a fresh and lightweight take on object-oriented design, plus some cool features like true closures and reflection.” Copyright (c) 2017
  12. …Introduction • Dev team can learn the basics quickly •

    Designed for modern programming • Object Oriented • Concurrency is finally easy • Builds to a single static binary • Developed by adapting good parts of every language to make it robust, dynamic and friendly Copyright (c) 2017
  13. …Introduction • Builds real fast • Mechanical sympathy • Strong

    library support • Cross platform • Runs on all Unix-like systems – Linux, FreeBSD, OpenBSD, Mac OS X • Plan 9, Windows • … Copyright (c) 2017
  14. Cross Platform Support Copyright (c) 2017 $GOOS $GOARCH android arm

    darwin 386 darwin amd64 darwin arm darwin arm64 dragonfly amd64 freebsd 386 freebsd amd64 freebsd arm $GOOS $GOARCH netbsd 386 netbsd amd64 netbsd arm openbsd 386 openbsd amd64 openbsd arm plan9 386 plan9 amd64 solaris amd64 windows 386 windows amd64 $GOOS $GOARCH linux 386 linux amd64 linux arm linux arm64 linux ppc64 linux ppc64le linux mips linux mipsle linux mips64 linux mips64le
  15. What does GO have • C-like and an easy syntax

    • Sophisticated garbage collection • Built-in primitives for concurrency support • Object oriented, statically typed with some dynamic typing capabilities • Small, yet rich and expressive • Go tool : download, build, install, test, Go packages and commands Copyright (c) 2017
  16. What does GO have • Static typing • Static library

    linking (by default) • Good package manager (go get) • Official code formatting tool (so we don’t have dozens of formatting standards) • System call interface • Growing community with awesome docs and support Copyright (c) 2017
  17. Library support.. • Tooling support • Race detector, Test, Benchmark,

    Profile (CPU, Heap, Memory), packaging, dependency management…. • Batteries included :-) provides clean building blocks and APIs for I/O, text processing, graphics, cryptography, networking, compression, context, with support for many standard file formats and protocols & much more... Copyright (c) 2017
  18. And.. • Libraries & tools make extensive use of convention

    to make things simple • Projects built using ‘go’ tool generally use only filenames, identifiers and an occasional special comment to determine all the libraries, executables, tests, benchmarks, examples, platform-specific variants, and documentation for a project; the Go source itself contains the build specification. Copyright (c) 2017
  19. Suited for • Writing scalable server side applications • Distributed

    systems and micro-services • Concurrent IO • Data processing pipelines • Tools • Writing large & even small programs • Robust enterprise grade software Copyright (c) 2017
  20. How easy is concurrency? • Really easy for i :=

    0; i < 1000000; i++ { go doWork(i) } • Go routines (dynamically sized stack, typically starts 2k) are cheap compared to expensive threads (fixed size stack ~2MB) • Built-in channel primitive help communicate between go routines Copyright (c) 2016
  21. Copyright (c) 2017 Why GO? • Productivity • Getting stuff

    done • Solve problems quickly • Low investment, don’t mind trying things or throwing bits away • Performance "We had a spike of about 2.4 million requests within ten minutes, and forgot to turn caching on! Luckily, since it only touched our Go code, it didn’t matter; we didn’t crash.“ -- Dean Elbaz, SongKick
  22. Copyright (c) 2017 Why GO? • New and intuitive way

    of thinking about software • Few core features but batteries included • Easy to pick up • Addictive philosophy "Go's simplicity means it's very easy to read or hear; that's especially important to me" -- Parham Doustdar, Blind go programmer from Tehran
  23. Copyright (c) 2017 Why GO? • Batteries included • net/http

    • database/sql… • Can talk to external C libraries or make native systems calls • Fast release cycles • Significant improvements in every release
  24. Copyright (c) 2017 Opinions Also being memory managed with garbage

    collection and being compiled to machine code with first class concurrency support means we get very high performance and much lower costs (very important for startups). While still being as fast to developing as a dynamic scripting languages such as Ruby or Python. Finally we wanted to make a solid technical choice at the beginning of our project that we would be happy scaling in the years. To come. I can’t think of anything more terrifying than re- architecting our platform underneath a running bank! - Mondo, a startup bank in UK
  25. Copyright (c) 2017 Some cool features • Go Playground (https://play.golang.org/)

    • Context • Provides timeout and cancelation mechanism across API boundaries and between processes • Cgo • GO packages can call C code • Library for mobile dev • Built in benchmarking and testing tool
  26. Copyright (c) 2017 Where to begin • Tour of GO

    • https://tour.golang.org • Basics to advanced topics (e.g. concurrency) • Examples and exercises • Available in many languages • Available offline • Go docs • https://golang.org/pkg, also available offline
  27. Copyright (c) 2017 Other websites • Gopher Academy • https://blog.gopheracademy.com/

    • Trainings • Ardan Labs Ultimate Go training (3/4-day) • Todd McLeod’s training on GOLang on Udemy • Better oriented towards students • Pluralsight
  28. Copyright (c) 2017 Other websites • Go by example •

    Has good examples on many areas with explanations https://gobyexample.com/ • Official GO Blog • https://blog.golang.org/ • Dave Chaney’s Blog • https://dave.cheney.net/ • Bill Keneddy’s blog • https://www.goinggo.net/
  29. Copyright (c) 2017 Books • The Go Programming Language by

    Alan A.A. Donovan and Brian W. Kernighan • Go in Action by Brian Ketelsen, Erik St. Martin, and William Kennedy
  30. Copyright (c) 2017 Editors • VSCode • https://code.visualstudio.com/ • Sublime

    Text • https://www.sublimetext.com/ • Setup help: https://www.wolfe.id.au/2015/03/05/using- sublime-text-for-go-development/ • …
  31. Copyright (c) 2017 Resources • Gopher Slack • http://bit.ly/1zUTGKh •

    Go-nuts Google Group-nuts • https://groups.google.com/forum/#!forum/gola ng-nuts
  32. Copyright (c) 2017 Resources • Conferences • Gophercon USA https://www.gophercon.com/

    • Gophercon India http://www.gophercon.in/ • Gophercon China http://gopherchina.org/ • Gophercon UAE http://www.gophercon.ae/ • Gophercon Singapore https://gophercon.sg/ • Gophercon Brazil ehttps://gopherconbr.org/en/ • GOLangUK http://golanguk.com/ …
  33. Copyright (c) 2017 Credits • Innumerable websites, blogs, resources on

    the internet :) • Slide review inputs by Daniel Whitenack Product/other names used in this presentation are trademark/copyright of respective owners