SlideShare a Scribd company logo
Go ? Go. Go !
Jean-François Bustarret - 1/12/2015
Why Go ?
Where : Google
Who : Rob Pike, Ken Thompson et Robert Griesemer
Why : C++ has a few problems
● maintenance problems as the codebase grows/ages
● productivity problems
● in a lot of cases, performance gains do not justify the time spent
Go vs competitor languages
C/C++
Java Go
Python
Performance
Developer Productivity
Goal #1: simplicity
● start with C
● remove every difficult to use feature (e.g. pointer arithmetics)
● add a couple of new features (GC, concurrency, maps, …)
● clean the syntax
● standardize coding style
Goal
● easy to learn
● easy to read/maintain existing code
● easy to parse
What is Go ?
● a compiled language, statically typed, with GC
● opinionated
● sequential and not event-driven
● concurrency
○ goroutines (collaborative multiplexing) - small CPU overhead, 2Ko RAM used, all CPU cores
available
○ channels (communication rather than sharing of state with mutexes)
● not object-oriented - composition prefered to inheritance
type Reader struct {...}
type Writer struct {...}
type ReadWriter struct { // has all methods and properties from both
Reader
Writer
}
What is Go ?
● first-class functions (a function is a value like any other)
type ReadFn func(buffer []byte) (int, error) // function type
func doSomething(fn ReadFn) {...} // function parameter
fn := func(buffer []byte) (int, error) {...} // anonymous functions
● methods on types
type FileReader struct {...}
func (rw *FileReader) Read(buffer []byte) (int, error) {...}
rw := NewFileReader()
rw.Read(...)
What is Go ?
● implicit interfaces (duck typing)
package io
type Reader interface {
Read(buffer []byte) (int, error)
}
package os
type File struct {...}
// os.File implements io.Reader
func (f *File) Read(buffer []byte) (int, error) {...}
What is Go ?
● reading a JSON document from a file
// Open a file
fd, err := os.Open(filename)
// Decode json data (takes a io.Reader as a parameter)
json.NewDecoder(fd).Decode(...)
● compressed data ?
fd, err := os.Open(filename)
bz := bzip2.NewReader(fd)
json.NewDecoder(bz).Decode(...)
What is Go ?
● HTTP ?
resp, err := http.Get("http://example.com/data.json.bz2")
// resp.Body implements io.Reader
bz := bzip2.NewReader(resp.Body)
json.NewDecoder(bz).Decode(...)
● Also works with
○ transports : FTP, ...
○ encodings : Base64, XML, ...
○ archives : tar, zip, ...
○ other : pipes
Strengths
Tooling
● formatting (go fmt)
● coding style analysis (go vet, go lint) and code analysis (oracle)
● refactoring (gorename)
● documentation (go doc)
● downloading packages from git, mercurial, ... (go get)
● code generation (go generate)
● debugging (gdb)
Community contributions: debuggers (delve (coreos), godebug (mailgun))
Strengths (cont.)
Standard library
● network, encoding, compression, crypto, …
● written in Go
Concurrency
Compiles to a (near) static binary, little to no dependency on 3rd party libs
Language stability (very good forward compatibility)
Weaknesses
True weaknesses
● Templating web vs Python/Ruby/PHP
● No generics
○ no implementation identified with acceptable impact on language simplicity
● Vendoring
○ work in progress
False weaknesses
● Verbose error management
● Hiring Go developers is difficult
● Performances
Can Go be used for high performance ?
Cloudflare (CDN) : log analysis, alerting, statistics
● 4 million log lines/s - 400 TB/day (after compression)
● https://www.youtube.com/watch?v=LA-gNoxSLCE
Youtube : vitess (MySQL proxy // PgBouncer on steroids)
● > 1 million MySQL queries/s
● https://github.com/youtube/vitess
Google : dl.google.com (all Google downloads - Chrome, Earth, SDK Android, …)
● replaces C++ with Go, < ½ code, better performance
● http://talks.golang.org/2013/oscon-dl.slide
Who uses Go ? What for ?
Infrastructure : containers, distributed or service oriented platforms
● Docker, Packer, Kubernetes, etcd, Consul, CoreOS
● NoSQL : InfluxDB, CockroachDB
● Supervision : Prometheus
● Message queues : NSQd, NATS
Startups heavily using Go
● Youtube, Bitly, Hailo, SoundCloud, Iron.io, Digital Ocean, twitch, Heroku, ...
References
Go philosophy :
● http://jmoiron.net/blog/for-better-or-for-worse/
● http://talks.golang.org/2012/splash.slide
● http://dave.cheney.net/2015/03/08/simplicity-and-collaboration
Documentation : https://golang.org/doc/effective_go.html
Learn Go : https://tour.golang.org

More Related Content

PDF
Lua زبان برنامه نویسی
PPTX
Go Programming language, golang
PPT
GO programming language
PPTX
File searching tools
PDF
ActiveDoc
PDF
Profile all the things! - Capital Go 2017
PDF
An introduction to go programming language
ODP
The History of Free Software
Lua زبان برنامه نویسی
Go Programming language, golang
GO programming language
File searching tools
ActiveDoc
Profile all the things! - Capital Go 2017
An introduction to go programming language
The History of Free Software

What's hot (13)

PDF
Bind Python and C @ COSCUP 2015
PPTX
How to train your python: iterables (FR)
PDF
My talk on GitHub open data at ITGM #10
PPTX
Intro of C
PDF
Doxygen
PDF
Beyond JSON with FlatBuffers
PPT
Doxygen - Source Code Documentation Generator Tool
ODP
Compress and the other side
PDF
Introduction to python
PDF
IT talk "Python language evolution"
PDF
Building Multilingual Websites in Drupal 7
PPTX
MongoDB Aug2010 SF Meetup
PPTX
Introduction to Python
Bind Python and C @ COSCUP 2015
How to train your python: iterables (FR)
My talk on GitHub open data at ITGM #10
Intro of C
Doxygen
Beyond JSON with FlatBuffers
Doxygen - Source Code Documentation Generator Tool
Compress and the other side
Introduction to python
IT talk "Python language evolution"
Building Multilingual Websites in Drupal 7
MongoDB Aug2010 SF Meetup
Introduction to Python
Ad

Viewers also liked (7)

PPTX
PostgreSQL and CockroachDB SQL
PDF
How to tackle a hackathon
PDF
What a christmas tree taught us about content marketing
PPTX
Functional programming with ES6
PDF
Turn Your API Into A Strong Product
PDF
End to-end apps with type script
PPTX
L’email de notification, canal de communication marketing
PostgreSQL and CockroachDB SQL
How to tackle a hackathon
What a christmas tree taught us about content marketing
Functional programming with ES6
Turn Your API Into A Strong Product
End to-end apps with type script
L’email de notification, canal de communication marketing
Ad

Similar to Why go ? (20)

PPTX
Introduction to go lang
PPTX
Go. Why it goes
PDF
PPT
A First Look at Google's Go Programming Language
PPT
Google's Go Programming Language - Introduction
PPTX
Go fundamentals
PDF
Inroduction to golang
PPTX
go language- haseeb.pptx
PDF
Introduction to Go
PDF
Go for Rubyists
PDF
Golang
PDF
Go. why it goes v2
PPTX
Golang - Overview of Go (golang) Language
PDF
Getting started with go - Florin Patan - Codemotion Milan 2016
PPTX
Ready, set, go! An introduction to the Go programming language
PPTX
Golang introduction
PDF
Getting started with Go - Florin Patan - Codemotion Rome 2017
PDF
Golang : A Hype or the Future?
PDF
An introduction to programming in Go
PDF
Intro to GO (Bangkok Launchpad 2014)
Introduction to go lang
Go. Why it goes
A First Look at Google's Go Programming Language
Google's Go Programming Language - Introduction
Go fundamentals
Inroduction to golang
go language- haseeb.pptx
Introduction to Go
Go for Rubyists
Golang
Go. why it goes v2
Golang - Overview of Go (golang) Language
Getting started with go - Florin Patan - Codemotion Milan 2016
Ready, set, go! An introduction to the Go programming language
Golang introduction
Getting started with Go - Florin Patan - Codemotion Rome 2017
Golang : A Hype or the Future?
An introduction to programming in Go
Intro to GO (Bangkok Launchpad 2014)

More from Mailjet (20)

PDF
Deliverability Mistakes to Avoid During the Holiday Season
PDF
Calendario de Adviento de Email Marketing - Mailjet
PDF
Cómo impulsar tus ventas navideñas con el email: El caso de Shoppiday + Mailje
PDF
Estrategias de email marketing para la temporada navideña
PDF
E-Mail Marketing in der Finanz- und Versicherungsbranche: Die Erfolgsfaktoren
PDF
Webinario: Las oportunidades de marketing que estás perdiendo en tus emails ...
PDF
Webinario: Cómo Trabajar Con Proveedores Externos En Conformidad Con El RGPD
PDF
Webinar : Comment la certification peut-elle vous permettre de démontrer votr...
PDF
Mailjet BigData - RGPD : les actions IT pour assurer la protection des données
PDF
Webinar Mailjet - RGPD & IT - Quelles actions pour assurer la protection des ...
PDF
El Consentimiento En El Mundo RGPD (GDPR)
PDF
5 Fórmulas Mágicas Para Diseñar Emails Atractivos
PDF
Introducción al Reglamento General de Protección de Datos (GDPR)
PDF
Erfolgreiche Kundenbefragung per E-Mail: So klappt’s
PDF
Wie E-Mail Personalisierug erfolgreich gelingt
PDF
Newsletter erstellen: der Schritt-für-Schritt Anleitung
PDF
Der optimale Versandzeitpunkt für Ihre E-Mail Kampagnen
PDF
DSGVO - So bereiten Sie sich richtig vor. Teil 1: Grundlegende Informationen
PDF
Wie effiziente E-Mail Automatisierung erfolgreich gelingt
PDF
How to get email right in 2018
Deliverability Mistakes to Avoid During the Holiday Season
Calendario de Adviento de Email Marketing - Mailjet
Cómo impulsar tus ventas navideñas con el email: El caso de Shoppiday + Mailje
Estrategias de email marketing para la temporada navideña
E-Mail Marketing in der Finanz- und Versicherungsbranche: Die Erfolgsfaktoren
Webinario: Las oportunidades de marketing que estás perdiendo en tus emails ...
Webinario: Cómo Trabajar Con Proveedores Externos En Conformidad Con El RGPD
Webinar : Comment la certification peut-elle vous permettre de démontrer votr...
Mailjet BigData - RGPD : les actions IT pour assurer la protection des données
Webinar Mailjet - RGPD & IT - Quelles actions pour assurer la protection des ...
El Consentimiento En El Mundo RGPD (GDPR)
5 Fórmulas Mágicas Para Diseñar Emails Atractivos
Introducción al Reglamento General de Protección de Datos (GDPR)
Erfolgreiche Kundenbefragung per E-Mail: So klappt’s
Wie E-Mail Personalisierug erfolgreich gelingt
Newsletter erstellen: der Schritt-für-Schritt Anleitung
Der optimale Versandzeitpunkt für Ihre E-Mail Kampagnen
DSGVO - So bereiten Sie sich richtig vor. Teil 1: Grundlegende Informationen
Wie effiziente E-Mail Automatisierung erfolgreich gelingt
How to get email right in 2018

Recently uploaded (20)

PPTX
Internet___Basics___Styled_ presentation
PPTX
Module 1 - Cyber Law and Ethics 101.pptx
PDF
The Ikigai Template _ Recalibrate How You Spend Your Time.pdf
PDF
The New Creative Director: How AI Tools for Social Media Content Creation Are...
PPTX
Funds Management Learning Material for Beg
PPTX
June-4-Sermon-Powerpoint.pptx USE THIS FOR YOUR MOTIVATION
PDF
Sims 4 Historia para lo sims 4 para jugar
PPTX
Power Point - Lesson 3_2.pptx grad school presentation
PPTX
Introduction to cybersecurity and digital nettiquette
PPTX
Database Information System - Management Information System
PDF
Vigrab.top – Online Tool for Downloading and Converting Social Media Videos a...
PPTX
INTERNET------BASICS-------UPDATED PPT PRESENTATION
PDF
Smart Home Technology for Health Monitoring (www.kiu.ac.ug)
PPTX
Mathew Digital SEO Checklist Guidlines 2025
DOCX
Unit-3 cyber security network security of internet system
PDF
Best Practices for Testing and Debugging Shopify Third-Party API Integrations...
PDF
Exploring VPS Hosting Trends for SMBs in 2025
DOC
Rose毕业证学历认证,利物浦约翰摩尔斯大学毕业证国外本科毕业证
PDF
Unit-1 introduction to cyber security discuss about how to secure a system
PDF
Introduction to the IoT system, how the IoT system works
Internet___Basics___Styled_ presentation
Module 1 - Cyber Law and Ethics 101.pptx
The Ikigai Template _ Recalibrate How You Spend Your Time.pdf
The New Creative Director: How AI Tools for Social Media Content Creation Are...
Funds Management Learning Material for Beg
June-4-Sermon-Powerpoint.pptx USE THIS FOR YOUR MOTIVATION
Sims 4 Historia para lo sims 4 para jugar
Power Point - Lesson 3_2.pptx grad school presentation
Introduction to cybersecurity and digital nettiquette
Database Information System - Management Information System
Vigrab.top – Online Tool for Downloading and Converting Social Media Videos a...
INTERNET------BASICS-------UPDATED PPT PRESENTATION
Smart Home Technology for Health Monitoring (www.kiu.ac.ug)
Mathew Digital SEO Checklist Guidlines 2025
Unit-3 cyber security network security of internet system
Best Practices for Testing and Debugging Shopify Third-Party API Integrations...
Exploring VPS Hosting Trends for SMBs in 2025
Rose毕业证学历认证,利物浦约翰摩尔斯大学毕业证国外本科毕业证
Unit-1 introduction to cyber security discuss about how to secure a system
Introduction to the IoT system, how the IoT system works

Why go ?

  • 1. Go ? Go. Go ! Jean-François Bustarret - 1/12/2015
  • 2. Why Go ? Where : Google Who : Rob Pike, Ken Thompson et Robert Griesemer Why : C++ has a few problems ● maintenance problems as the codebase grows/ages ● productivity problems ● in a lot of cases, performance gains do not justify the time spent
  • 3. Go vs competitor languages C/C++ Java Go Python Performance Developer Productivity
  • 4. Goal #1: simplicity ● start with C ● remove every difficult to use feature (e.g. pointer arithmetics) ● add a couple of new features (GC, concurrency, maps, …) ● clean the syntax ● standardize coding style Goal ● easy to learn ● easy to read/maintain existing code ● easy to parse
  • 5. What is Go ? ● a compiled language, statically typed, with GC ● opinionated ● sequential and not event-driven ● concurrency ○ goroutines (collaborative multiplexing) - small CPU overhead, 2Ko RAM used, all CPU cores available ○ channels (communication rather than sharing of state with mutexes) ● not object-oriented - composition prefered to inheritance type Reader struct {...} type Writer struct {...} type ReadWriter struct { // has all methods and properties from both Reader Writer }
  • 6. What is Go ? ● first-class functions (a function is a value like any other) type ReadFn func(buffer []byte) (int, error) // function type func doSomething(fn ReadFn) {...} // function parameter fn := func(buffer []byte) (int, error) {...} // anonymous functions ● methods on types type FileReader struct {...} func (rw *FileReader) Read(buffer []byte) (int, error) {...} rw := NewFileReader() rw.Read(...)
  • 7. What is Go ? ● implicit interfaces (duck typing) package io type Reader interface { Read(buffer []byte) (int, error) } package os type File struct {...} // os.File implements io.Reader func (f *File) Read(buffer []byte) (int, error) {...}
  • 8. What is Go ? ● reading a JSON document from a file // Open a file fd, err := os.Open(filename) // Decode json data (takes a io.Reader as a parameter) json.NewDecoder(fd).Decode(...) ● compressed data ? fd, err := os.Open(filename) bz := bzip2.NewReader(fd) json.NewDecoder(bz).Decode(...)
  • 9. What is Go ? ● HTTP ? resp, err := http.Get("http://example.com/data.json.bz2") // resp.Body implements io.Reader bz := bzip2.NewReader(resp.Body) json.NewDecoder(bz).Decode(...) ● Also works with ○ transports : FTP, ... ○ encodings : Base64, XML, ... ○ archives : tar, zip, ... ○ other : pipes
  • 10. Strengths Tooling ● formatting (go fmt) ● coding style analysis (go vet, go lint) and code analysis (oracle) ● refactoring (gorename) ● documentation (go doc) ● downloading packages from git, mercurial, ... (go get) ● code generation (go generate) ● debugging (gdb) Community contributions: debuggers (delve (coreos), godebug (mailgun))
  • 11. Strengths (cont.) Standard library ● network, encoding, compression, crypto, … ● written in Go Concurrency Compiles to a (near) static binary, little to no dependency on 3rd party libs Language stability (very good forward compatibility)
  • 12. Weaknesses True weaknesses ● Templating web vs Python/Ruby/PHP ● No generics ○ no implementation identified with acceptable impact on language simplicity ● Vendoring ○ work in progress False weaknesses ● Verbose error management ● Hiring Go developers is difficult ● Performances
  • 13. Can Go be used for high performance ? Cloudflare (CDN) : log analysis, alerting, statistics ● 4 million log lines/s - 400 TB/day (after compression) ● https://www.youtube.com/watch?v=LA-gNoxSLCE Youtube : vitess (MySQL proxy // PgBouncer on steroids) ● > 1 million MySQL queries/s ● https://github.com/youtube/vitess Google : dl.google.com (all Google downloads - Chrome, Earth, SDK Android, …) ● replaces C++ with Go, < ½ code, better performance ● http://talks.golang.org/2013/oscon-dl.slide
  • 14. Who uses Go ? What for ? Infrastructure : containers, distributed or service oriented platforms ● Docker, Packer, Kubernetes, etcd, Consul, CoreOS ● NoSQL : InfluxDB, CockroachDB ● Supervision : Prometheus ● Message queues : NSQd, NATS Startups heavily using Go ● Youtube, Bitly, Hailo, SoundCloud, Iron.io, Digital Ocean, twitch, Heroku, ...
  • 15. References Go philosophy : ● http://jmoiron.net/blog/for-better-or-for-worse/ ● http://talks.golang.org/2012/splash.slide ● http://dave.cheney.net/2015/03/08/simplicity-and-collaboration Documentation : https://golang.org/doc/effective_go.html Learn Go : https://tour.golang.org