SlideShare una empresa de Scribd logo
Introduction to Go
AND WHY IT’S AWESOME
About me
SWE at Google
Open source
Kubernetes written in Go
https://github.com/kubernetes/kubernetes
Today you’ll learn
What is Go?
Why Go?
Basic Syntax
Features
A little background
about Go...
History
Started at Google
Released, open-sourced in 2009
New, modern
20161945
C
1972
Python
1991
Java
JavaScript
1995
Go
2009
https://golang.org/
Why Go?
Google internal needs
★ Efficient large scale programming
★ Distributed systems
★ Speed of compilation
★ Multicore, networked hardware
http://xkcd.com/
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
Design Principles
Simplicity concepts easy to understand
Orthogonality concepts mix cleanly
Readability comprehensible with little context
Companies Using Go
http://stackshare.io/go/in-stacks
Some basic syntax
Hello World
Functions
Object-oriented?
Yes and no...
Composition over inheritance
★ No type hierarchy
★ No class
★ No generics
Simple Type System
Statically typed, with type inference
Types and methods
You can define methods on any type I mean ANY
Interfaces
An interface type defines a set of methods
More on Go features
Concurrency
UNIX: processes connected by pipes
$ find ~/go/src/pkg | grep _test.go$ | xargs wc -l
Go: goroutines connected by channels, concurrency made easy to use
Concurrency: goroutines
Lightweight threads
Concurrency: channels
Channels are a typed pipe for
★ Synchronization
★ Communication
Concurrency philosophy
The efficiency of an asynchronous model written in a synchronous style
Connect goroutines with channels -- simpler, maintainable code
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”
Rich library support
Comprehensive standard library
150+ packages
Many great external libraries
120, 000+ packages
https://godoc.org/
What’s Go good for?
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
Demo:
a simple web app
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
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/

Más contenido relacionado

La actualidad más candente

High Availability from the DevOps side - OpenStack Summit Portland
High Availability from the DevOps side - OpenStack Summit PortlandHigh Availability from the DevOps side - OpenStack Summit Portland
High Availability from the DevOps side - OpenStack Summit Portland
eNovance
 

La actualidad más candente (20)

Containers: Under The Hood (Vincent Batts)
Containers: Under The Hood (Vincent Batts)Containers: Under The Hood (Vincent Batts)
Containers: Under The Hood (Vincent Batts)
 
CDK 2.0: Docker, Kubernetes, And OSE On Your Desk (Langdon White)
CDK 2.0: Docker, Kubernetes, And OSE On Your Desk (Langdon White)CDK 2.0: Docker, Kubernetes, And OSE On Your Desk (Langdon White)
CDK 2.0: Docker, Kubernetes, And OSE On Your Desk (Langdon White)
 
Pulumi. Modern Infrastructure as Code.
Pulumi. Modern Infrastructure as Code.Pulumi. Modern Infrastructure as Code.
Pulumi. Modern Infrastructure as Code.
 
Container Orchestration using Kubernetes
Container Orchestration using KubernetesContainer Orchestration using Kubernetes
Container Orchestration using Kubernetes
 
Continuous integration ( jen kins travis ci)
Continuous integration ( jen kins  travis ci)Continuous integration ( jen kins  travis ci)
Continuous integration ( jen kins travis ci)
 
Testing strategies for Docker containers
Testing strategies for Docker containersTesting strategies for Docker containers
Testing strategies for Docker containers
 
SciPipe - A light-weight workflow library inspired by flow-based programming
SciPipe - A light-weight workflow library inspired by flow-based programmingSciPipe - A light-weight workflow library inspired by flow-based programming
SciPipe - A light-weight workflow library inspired by flow-based programming
 
OpenShift, Docker, Kubernetes: The next generation of PaaS
OpenShift, Docker, Kubernetes: The next generation of PaaSOpenShift, Docker, Kubernetes: The next generation of PaaS
OpenShift, Docker, Kubernetes: The next generation of PaaS
 
Docker multi-stage build
Docker multi-stage buildDocker multi-stage build
Docker multi-stage build
 
Deploying to DigitalOcean With GitHub Actions
Deploying to DigitalOcean With GitHub ActionsDeploying to DigitalOcean With GitHub Actions
Deploying to DigitalOcean With GitHub Actions
 
COSCUP 2017 - infrastructure As Code
COSCUP 2017 - infrastructure As Code COSCUP 2017 - infrastructure As Code
COSCUP 2017 - infrastructure As Code
 
CI/CD with Openshift and Jenkins
CI/CD with Openshift and JenkinsCI/CD with Openshift and Jenkins
CI/CD with Openshift and Jenkins
 
Debugging Go in Kubernetes
Debugging Go in KubernetesDebugging Go in Kubernetes
Debugging Go in Kubernetes
 
Continous Delivery to Kubernetes using Helm
Continous Delivery to Kubernetes using HelmContinous Delivery to Kubernetes using Helm
Continous Delivery to Kubernetes using Helm
 
Docker at Cloud9 IDE
Docker at Cloud9 IDEDocker at Cloud9 IDE
Docker at Cloud9 IDE
 
Infrastructure as "Code" with Pulumi
Infrastructure as "Code" with PulumiInfrastructure as "Code" with Pulumi
Infrastructure as "Code" with Pulumi
 
High Availability from the DevOps side - OpenStack Summit Portland
High Availability from the DevOps side - OpenStack Summit PortlandHigh Availability from the DevOps side - OpenStack Summit Portland
High Availability from the DevOps side - OpenStack Summit Portland
 
ContainerDayVietnam2016: Become a Cloud-native Developer
ContainerDayVietnam2016: Become a Cloud-native DeveloperContainerDayVietnam2016: Become a Cloud-native Developer
ContainerDayVietnam2016: Become a Cloud-native Developer
 
ContainerDayVietnam2016: Docker for JS Developer
ContainerDayVietnam2016: Docker for JS DeveloperContainerDayVietnam2016: Docker for JS Developer
ContainerDayVietnam2016: Docker for JS Developer
 
Running Production-Grade Kubernetes on AWS
Running Production-Grade Kubernetes on AWSRunning Production-Grade Kubernetes on AWS
Running Production-Grade Kubernetes on AWS
 

Similar a Introduction to go, and why it's awesome

Similar a Introduction to go, and why it's awesome (20)

Introduction to Go
Introduction to GoIntroduction to Go
Introduction to Go
 
Scaling applications with go
Scaling applications with goScaling applications with go
Scaling applications with go
 
Introduction to go lang
Introduction to go langIntroduction to go lang
Introduction to go lang
 
An Introduction to Go
An Introduction to GoAn Introduction to Go
An Introduction to Go
 
Features of go
Features of goFeatures of go
Features of go
 
Golang workshop - Mindbowser
Golang workshop - MindbowserGolang workshop - Mindbowser
Golang workshop - Mindbowser
 
Introduction To Web Development & The New Digital Workplace
Introduction To Web Development & The New Digital WorkplaceIntroduction To Web Development & The New Digital Workplace
Introduction To Web Development & The New Digital Workplace
 
An introduction to go programming language
An introduction to go programming languageAn introduction to go programming language
An introduction to go programming language
 
Why Go Lang?
Why Go Lang?Why Go Lang?
Why Go Lang?
 
IPT 2.pptx
IPT 2.pptxIPT 2.pptx
IPT 2.pptx
 
Go fundamentals
Go fundamentalsGo fundamentals
Go fundamentals
 
C4ainaction-Introduction to the Pyramid Web Framework
C4ainaction-Introduction to the Pyramid Web FrameworkC4ainaction-Introduction to the Pyramid Web Framework
C4ainaction-Introduction to the Pyramid Web Framework
 
Google's Go Programming Language - Introduction
Google's Go Programming Language - Introduction Google's Go Programming Language - Introduction
Google's Go Programming Language - Introduction
 
A First Look at Google's Go Programming Language
A First Look at Google's Go Programming LanguageA First Look at Google's Go Programming Language
A First Look at Google's Go Programming Language
 
Docker based-Pipelines with Codefresh
Docker based-Pipelines with CodefreshDocker based-Pipelines with Codefresh
Docker based-Pipelines with Codefresh
 
Docker for business: How I stopped worrying about antipatterns
Docker for business: How I stopped worrying about antipatternsDocker for business: How I stopped worrying about antipatterns
Docker for business: How I stopped worrying about antipatterns
 
Multi-stage Docker builds to make building easy!
Multi-stage Docker builds to make building easy!Multi-stage Docker builds to make building easy!
Multi-stage Docker builds to make building easy!
 
Introduction to go
Introduction to goIntroduction to go
Introduction to go
 
Go: What's Different ?
Go: What's Different ?Go: What's Different ?
Go: What's Different ?
 
Intro to Go
Intro to GoIntro to Go
Intro to Go
 

Último

JustNaik Solution Deck (stage bus sector)
JustNaik Solution Deck (stage bus sector)JustNaik Solution Deck (stage bus sector)
JustNaik Solution Deck (stage bus sector)
Max Lee
 

Último (20)

De mooiste recreatieve routes ontdekken met RouteYou en FME
De mooiste recreatieve routes ontdekken met RouteYou en FMEDe mooiste recreatieve routes ontdekken met RouteYou en FME
De mooiste recreatieve routes ontdekken met RouteYou en FME
 
Abortion ^Clinic ^%[+971588192166''] Abortion Pill Al Ain (?@?) Abortion Pill...
Abortion ^Clinic ^%[+971588192166''] Abortion Pill Al Ain (?@?) Abortion Pill...Abortion ^Clinic ^%[+971588192166''] Abortion Pill Al Ain (?@?) Abortion Pill...
Abortion ^Clinic ^%[+971588192166''] Abortion Pill Al Ain (?@?) Abortion Pill...
 
Facemoji Keyboard released its 2023 State of Emoji report, outlining the most...
Facemoji Keyboard released its 2023 State of Emoji report, outlining the most...Facemoji Keyboard released its 2023 State of Emoji report, outlining the most...
Facemoji Keyboard released its 2023 State of Emoji report, outlining the most...
 
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERRORTROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
 
Breaking the Code : A Guide to WhatsApp Business API.pdf
Breaking the Code : A Guide to WhatsApp Business API.pdfBreaking the Code : A Guide to WhatsApp Business API.pdf
Breaking the Code : A Guide to WhatsApp Business API.pdf
 
5 Reasons Driving Warehouse Management Systems Demand
5 Reasons Driving Warehouse Management Systems Demand5 Reasons Driving Warehouse Management Systems Demand
5 Reasons Driving Warehouse Management Systems Demand
 
INGKA DIGITAL: Linked Metadata by Design
INGKA DIGITAL: Linked Metadata by DesignINGKA DIGITAL: Linked Metadata by Design
INGKA DIGITAL: Linked Metadata by Design
 
Advanced Flow Concepts Every Developer Should Know
Advanced Flow Concepts Every Developer Should KnowAdvanced Flow Concepts Every Developer Should Know
Advanced Flow Concepts Every Developer Should Know
 
KLARNA - Language Models and Knowledge Graphs: A Systems Approach
KLARNA -  Language Models and Knowledge Graphs: A Systems ApproachKLARNA -  Language Models and Knowledge Graphs: A Systems Approach
KLARNA - Language Models and Knowledge Graphs: A Systems Approach
 
A Guideline to Gorgias to to Re:amaze Data Migration
A Guideline to Gorgias to to Re:amaze Data MigrationA Guideline to Gorgias to to Re:amaze Data Migration
A Guideline to Gorgias to to Re:amaze Data Migration
 
A Comprehensive Appium Guide for Hybrid App Automation Testing.pdf
A Comprehensive Appium Guide for Hybrid App Automation Testing.pdfA Comprehensive Appium Guide for Hybrid App Automation Testing.pdf
A Comprehensive Appium Guide for Hybrid App Automation Testing.pdf
 
Implementing KPIs and Right Metrics for Agile Delivery Teams.pdf
Implementing KPIs and Right Metrics for Agile Delivery Teams.pdfImplementing KPIs and Right Metrics for Agile Delivery Teams.pdf
Implementing KPIs and Right Metrics for Agile Delivery Teams.pdf
 
Into the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdfInto the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdf
 
A Python-based approach to data loading in TM1 - Using Airflow as an ETL for TM1
A Python-based approach to data loading in TM1 - Using Airflow as an ETL for TM1A Python-based approach to data loading in TM1 - Using Airflow as an ETL for TM1
A Python-based approach to data loading in TM1 - Using Airflow as an ETL for TM1
 
JustNaik Solution Deck (stage bus sector)
JustNaik Solution Deck (stage bus sector)JustNaik Solution Deck (stage bus sector)
JustNaik Solution Deck (stage bus sector)
 
Top Mobile App Development Companies 2024
Top Mobile App Development Companies 2024Top Mobile App Development Companies 2024
Top Mobile App Development Companies 2024
 
OpenChain @ LF Japan Executive Briefing - May 2024
OpenChain @ LF Japan Executive Briefing - May 2024OpenChain @ LF Japan Executive Briefing - May 2024
OpenChain @ LF Japan Executive Briefing - May 2024
 
How to install and activate eGrabber JobGrabber
How to install and activate eGrabber JobGrabberHow to install and activate eGrabber JobGrabber
How to install and activate eGrabber JobGrabber
 
Designing for Privacy in Amazon Web Services
Designing for Privacy in Amazon Web ServicesDesigning for Privacy in Amazon Web Services
Designing for Privacy in Amazon Web Services
 
Agnieszka Andrzejewska - BIM School Course in Kraków
Agnieszka Andrzejewska - BIM School Course in KrakówAgnieszka Andrzejewska - BIM School Course in Kraków
Agnieszka Andrzejewska - BIM School Course in Kraków
 

Introduction to go, and why it's awesome

Notas del editor

  1. Description: Go (又稱 Golang) 是 Google 在 2009 年推出的程式語言。go 以好讀、好寫、執行效率高為主打,也很適合拿來開發 web services。除了 Google 之外,許多公司,包括 Uber、Medium、Docker 等也使用 Go 來開發產品。究竟 Go 有什麼魅力?想知道更多,歡迎來參加這次的讀書會!
  2. http://stackshare.io/go/in-stacks
  3. A bit like C
  4. 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
  5. Notice that the type comes after the variable name. Why? https://blog.golang.org/gos-declaration-syntax
  6. Go is statically typed, but type inference saves repetition.
  7. A struct is a type which contains named fields Go “objects” are just values. There is no “box”.
  8. 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)
  9. A simple web app demo