SlideShare a Scribd company logo
Suelen Goularte Carvalho
suelengc@ime.usp.br
Computação Paralela e Distribuída
Profº Alfredo Goldman
Junho/2015
Go is a programming language
designed by Google to help
solve Google's problems.
What is Go?
And has big
problems!
Which (big) problems?
● Hardware is big and the software is big
● There are many millions of lines of software
● Servers mostly in C++ and lots of Java and Python
● Thousands of engineers work on the code
● And of course, all this software runs on zillions of
machines.
In short, development at
is big, can be slow, and is often
clumsy. But it is effective.
''
''
https://talks.golang.org/2012/splash.article
A lot of others people
help to bring go from
prototype to reality.
Go became a public
Open Source
project.
https://golang.org/doc/faq#history
2008 2009 20102007
Starts to have
adoption by other
programmers
Started and built by
Robert Griesemer,
Rob Pike and Ken
Thompson as a
part-time project.
History
● Ken Thompson (B, C, Unix, UTF-8)
● Rob Pike (Unix, UTF-8)
● Robert Griesemer (Hotspot, JVM)
...and a few others engineers at Google
Who were the founders?
2013 20142012
Version history
Go 1.4 (December)
Go 1.3 (June)
Go 1 (March)
Go 1.2 (December)
Go 1.1 (May)
https://golang.org/project/
● Eliminate slowness
● Eliminate clumsiness
● Improve productive
● Maintain (and improve) scale
It was designed by and for people who write, read,
debug and maintain large software systems.
Go's purpose is not to do research programming
language design.
Go's purpose is to make its designers' programming
lives better.
Why Go?
Go is a compiled, concurrent,
garbage-collected, statically typed
language developed at .
What is Go?
fix, fmt, get, install, list, tool,
version, vet.
build compile packages and dependencies
run compile and run Go program
clean remove object files
env print Go environment information
test test packages and benchmarks
Go is a tool for managing Go source code...
Mainly tools:
Others tools:
Who are using today?
https://github.com/golang/go/wiki/GoUsers
❏ Compiled
❏ Garbage-collected
❏ Has your own runtime
❏ Simple syntax
❏ Great standard library
❏ Cross-platform
❏ Object Oriented (without inheritance)
❏ Statically and stronger typed
❏ Concurrent (goroutines)
❏ Closures
❏ Explicity dependencies
❏ Multiple return values
❏ Pointers
❏ and so on...
What will you see in Go?
Have not been implemented in
favor of efficiency.
❏ Exception handling
❏ Inheritance
❏ Generics
❏ Assert
❏ Method overload
What will you not
see in Go?
see a bit of code!
Packages
● Each Go program are compound per packages
● Programs starts from main package
● This example are using the ftm and math packages
$ go run packages.go
My favorite number is 1
● The var instruction declares a list of variables
● The type is informed at the end
● The var instruction could be in a package or in a function
● The var instruction could includes initializers, 1 per variable. In
this case, the type could be ommited because it will be inferred
Variables
$ go run variables.go
0 false false false
$ go run variables-with-initiali
1 2 true false no!
$ go run constants.go
Hello world! Happy 3.14 Day! Go rules?
true
● Constants are declared like variables but with keyword const
● Can not use the syntx :=
Constants
● Inside a function, the short attribution instruction :=
can be used instead of a var declaration
Short variables declarations
$ go run short-variable-declarations.go
1 2 3 true false no!
Functions
● Functions could have zero or more arguments
● Notice that the type comes after the parameter name,
like variables
$ go run functions.go
55
● A function can have multiple return values
Multiple return values
$ go run multiple-results.go
world hello
● Go has just for as looping structure
● It is very similar with C or Java code, except for ( )
● Start and end declarations can be empty
Looping For
$ go run for.go
45
$ go run for-continu
1024
$ go run for-is-go-while.go
1024
● Semicolon can be removed and you will have while
● for can run forever
Looping "while" and forever
$ go run forever.go
process took too long
● It is very similar with C or Java code, except for ( )
if Condition
$ go run if.go
1.4142135623730951 2i
$ go run switch.go
Go runs on nacl.
● It is very similar with C or Java code, except for ( )
Switch Condition
$ go run defer.go
hello world
Defer
● Postponing the execution of a function until the function returns
● The arguments of the deferred calls are evaluated immediately
What more?
● Pointer
● Struct
● Matrix
● Slice
● Range
● Map
● Value function
● Closures
● Method
● Interface
● Stringer
● Error
● and a lot of more!!!
http://go-tour-br.appspot.com
$ go run http.go
A web server
● It is just simple to build a web server with 15 lines or less!!
Could you belive that???
● To execute a goroutine, just go!
● To send or receive information between the
goroutines, use channels
● Use the GOMAXPROCS environment variable to
define the amount of threads
Concurrency (goroutines)
$ go run goroutines.go
hello
world
hello
world
hello
world
hello
world
hello
● A goroutine is a lightweight thread managed by Go runtime
Goroutines
$ go run channels.go
17 -5 12
Channels
● Channels are typed's conduit through which you can send and receive
values with the channel operator <-
Unbuffered Channels
http://www.goinggo.net/2014/02/the-nature-of-channels-in-go.html
c := make (chan int)
Buffered Channels
http://www.goinggo.net/2014/02/the-nature-of-channels-in-go.html
c := make (chan int, 10)
Now you are ready to
!
Bibliografia
❏ http://golang.org
❏ http://go-tour-br.appspot.com/
❏ https://tour.golang.org
❏ http://www.golangbr.org/
❏ https://vimeo.com/49718712
❏ http://gophercon.com
❏ http://www.infoq.com/br/news/2014/09/go-1-3
❏ http://www.casadocodigo.com.br/products/livro-google-go
❏ https://pt.wikipedia.org/wiki/Inferno_(sistema_operacional)
❏ http://www.grokpodcast.com/series/a-linguagem-go/
❏ https://pt.wikipedia.org/wiki/Go_(linguagem_de_programação)
❏ https://gobyexample.com
❏ http://www.goinggo.net/2014/02/the-nature-of-channels-in-go.html
❏ http://www.goinggo.net/2013/09/detecting-race-conditions-with-go.html?m=1
❏ https://en.wikipedia.org/wiki/Green_threads
❏ http://www.toptal.com/go/go-programming-a-step-by-step-introductory-tutorial
Questions?

More Related Content

What's hot

Golang 101
Golang 101Golang 101
Golang 101
宇 傅
 
Introduction to go language programming
Introduction to go language programmingIntroduction to go language programming
Introduction to go language programming
Mahmoud Masih Tehrani
 
Golang Template
Golang TemplateGolang Template
Golang Template
Karthick Kumar
 
Write microservice in golang
Write microservice in golangWrite microservice in golang
Write microservice in golang
Bo-Yi Wu
 
Golang getting started
Golang getting startedGolang getting started
Golang getting started
Harshad Patil
 
Power-up services with gRPC
Power-up services with gRPCPower-up services with gRPC
Power-up services with gRPC
The Software House
 
HTTP2 and gRPC
HTTP2 and gRPCHTTP2 and gRPC
HTTP2 and gRPC
Guo Jing
 
CI with Gitlab & Docker
CI with Gitlab & DockerCI with Gitlab & Docker
CI with Gitlab & Docker
Joerg Henning
 
gRPC with java
gRPC with javagRPC with java
gRPC with java
Knoldus Inc.
 
Go vs Python Comparison
Go vs Python ComparisonGo vs Python Comparison
Go vs Python Comparison
Simplilearn
 
GO programming language
GO programming languageGO programming language
GO programming language
tung vu
 
Continuous Integration/Deployment with Gitlab CI
Continuous Integration/Deployment with Gitlab CIContinuous Integration/Deployment with Gitlab CI
Continuous Integration/Deployment with Gitlab CI
David Hahn
 
Developing Cross platform apps in flutter (Android, iOS, Web)
Developing Cross platform apps in flutter (Android, iOS, Web)Developing Cross platform apps in flutter (Android, iOS, Web)
Developing Cross platform apps in flutter (Android, iOS, Web)
Priyanka Tyagi
 
Golang basics for Java developers - Part 1
Golang basics for Java developers - Part 1Golang basics for Java developers - Part 1
Golang basics for Java developers - Part 1
Robert Stern
 
Dart and Flutter Basics.pptx
Dart and Flutter Basics.pptxDart and Flutter Basics.pptx
Dart and Flutter Basics.pptx
DSCVSSUT
 
Gitlab ci, cncf.sk
Gitlab ci, cncf.skGitlab ci, cncf.sk
Gitlab ci, cncf.sk
Juraj Hantak
 
gRPC - RPC rebirth?
gRPC - RPC rebirth?gRPC - RPC rebirth?
gRPC - RPC rebirth?
Luís Barbosa
 
What is Flutter
What is FlutterWhat is Flutter
What is Flutter
Malan Amarasinghe
 
Git 101: Git and GitHub for Beginners
Git 101: Git and GitHub for Beginners Git 101: Git and GitHub for Beginners
Git 101: Git and GitHub for Beginners
HubSpot
 
Why and How to Run Your Own Gitlab Runners as Your Company Grows
Why and How to Run Your Own Gitlab Runners as Your Company GrowsWhy and How to Run Your Own Gitlab Runners as Your Company Grows
Why and How to Run Your Own Gitlab Runners as Your Company Grows
NGINX, Inc.
 

What's hot (20)

Golang 101
Golang 101Golang 101
Golang 101
 
Introduction to go language programming
Introduction to go language programmingIntroduction to go language programming
Introduction to go language programming
 
Golang Template
Golang TemplateGolang Template
Golang Template
 
Write microservice in golang
Write microservice in golangWrite microservice in golang
Write microservice in golang
 
Golang getting started
Golang getting startedGolang getting started
Golang getting started
 
Power-up services with gRPC
Power-up services with gRPCPower-up services with gRPC
Power-up services with gRPC
 
HTTP2 and gRPC
HTTP2 and gRPCHTTP2 and gRPC
HTTP2 and gRPC
 
CI with Gitlab & Docker
CI with Gitlab & DockerCI with Gitlab & Docker
CI with Gitlab & Docker
 
gRPC with java
gRPC with javagRPC with java
gRPC with java
 
Go vs Python Comparison
Go vs Python ComparisonGo vs Python Comparison
Go vs Python Comparison
 
GO programming language
GO programming languageGO programming language
GO programming language
 
Continuous Integration/Deployment with Gitlab CI
Continuous Integration/Deployment with Gitlab CIContinuous Integration/Deployment with Gitlab CI
Continuous Integration/Deployment with Gitlab CI
 
Developing Cross platform apps in flutter (Android, iOS, Web)
Developing Cross platform apps in flutter (Android, iOS, Web)Developing Cross platform apps in flutter (Android, iOS, Web)
Developing Cross platform apps in flutter (Android, iOS, Web)
 
Golang basics for Java developers - Part 1
Golang basics for Java developers - Part 1Golang basics for Java developers - Part 1
Golang basics for Java developers - Part 1
 
Dart and Flutter Basics.pptx
Dart and Flutter Basics.pptxDart and Flutter Basics.pptx
Dart and Flutter Basics.pptx
 
Gitlab ci, cncf.sk
Gitlab ci, cncf.skGitlab ci, cncf.sk
Gitlab ci, cncf.sk
 
gRPC - RPC rebirth?
gRPC - RPC rebirth?gRPC - RPC rebirth?
gRPC - RPC rebirth?
 
What is Flutter
What is FlutterWhat is Flutter
What is Flutter
 
Git 101: Git and GitHub for Beginners
Git 101: Git and GitHub for Beginners Git 101: Git and GitHub for Beginners
Git 101: Git and GitHub for Beginners
 
Why and How to Run Your Own Gitlab Runners as Your Company Grows
Why and How to Run Your Own Gitlab Runners as Your Company GrowsWhy and How to Run Your Own Gitlab Runners as Your Company Grows
Why and How to Run Your Own Gitlab Runners as Your Company Grows
 

Similar to Go lang

go language- haseeb.pptx
go language- haseeb.pptxgo language- haseeb.pptx
go language- haseeb.pptx
ArsalanMaqsood1
 
An introduction to programming in Go
An introduction to programming in GoAn introduction to programming in Go
An introduction to programming in Go
David Robert Camargo de Campos
 
Go fundamentals
Go fundamentalsGo fundamentals
Go fundamentals
Ron Barabash
 
Introduction to go lang
Introduction to go langIntroduction to go lang
Introduction to go lang
Amal Mohan N
 
Golang
GolangGolang
Golang
Saray Chak
 
Go, meet Lua
Go, meet LuaGo, meet Lua
Go, meet Lua
Andre Burgaud
 
Go. Why it goes
Go. Why it goesGo. Why it goes
Go. Why it goes
Sergey Pichkurov
 
Why Go Lang?
Why Go Lang?Why Go Lang?
Why Go Lang?
Sathish VJ
 
Golang - Overview of Go (golang) Language
Golang - Overview of Go (golang) LanguageGolang - Overview of Go (golang) Language
Golang - Overview of Go (golang) Language
Aniruddha Chakrabarti
 
Working With Legacy Code
Working With Legacy CodeWorking With Legacy Code
Working With Legacy Code
Andrea Polci
 
How go makes us faster (May 2015)
How go makes us faster (May 2015)How go makes us faster (May 2015)
How go makes us faster (May 2015)
Wilfried Schobeiri
 
Me&g@home
Me&g@home Me&g@home
Me&g@home
Vytautas Dauksa
 
Ruby, the language of devops
Ruby, the language of devopsRuby, the language of devops
Ruby, the language of devops
Rob Kinyon
 
Improve the deployment process step by step
Improve the deployment process step by stepImprove the deployment process step by step
Improve the deployment process step by step
Daniel Fahlke
 
Mender.io | Develop embedded applications faster | Comparing C and Golang
Mender.io | Develop embedded applications faster | Comparing C and GolangMender.io | Develop embedded applications faster | Comparing C and Golang
Mender.io | Develop embedded applications faster | Comparing C and Golang
Mender.io
 
Passing the Joel Test in the PHP World (phpbnl10)
Passing the Joel Test in the PHP World (phpbnl10)Passing the Joel Test in the PHP World (phpbnl10)
Passing the Joel Test in the PHP World (phpbnl10)
Lorna Mitchell
 
Golang nuts (by Nii Nai at DevCongress 2013)
Golang nuts (by Nii Nai at DevCongress 2013)Golang nuts (by Nii Nai at DevCongress 2013)
Golang nuts (by Nii Nai at DevCongress 2013)
DevCongress
 
Introduction to Go
Introduction to GoIntroduction to Go
Introduction to Go
Simon Hewitt
 
JavaScript From Hell - CONFidence 2.0 2009
JavaScript From Hell - CONFidence 2.0 2009JavaScript From Hell - CONFidence 2.0 2009
JavaScript From Hell - CONFidence 2.0 2009Mario Heiderich
 

Similar to Go lang (20)

go language- haseeb.pptx
go language- haseeb.pptxgo language- haseeb.pptx
go language- haseeb.pptx
 
An introduction to programming in Go
An introduction to programming in GoAn introduction to programming in Go
An introduction to programming in Go
 
Go fundamentals
Go fundamentalsGo fundamentals
Go fundamentals
 
Introduction to go lang
Introduction to go langIntroduction to go lang
Introduction to go lang
 
Golang
GolangGolang
Golang
 
Go, meet Lua
Go, meet LuaGo, meet Lua
Go, meet Lua
 
Go. Why it goes
Go. Why it goesGo. Why it goes
Go. Why it goes
 
Golang preso
Golang presoGolang preso
Golang preso
 
Why Go Lang?
Why Go Lang?Why Go Lang?
Why Go Lang?
 
Golang - Overview of Go (golang) Language
Golang - Overview of Go (golang) LanguageGolang - Overview of Go (golang) Language
Golang - Overview of Go (golang) Language
 
Working With Legacy Code
Working With Legacy CodeWorking With Legacy Code
Working With Legacy Code
 
How go makes us faster (May 2015)
How go makes us faster (May 2015)How go makes us faster (May 2015)
How go makes us faster (May 2015)
 
Me&g@home
Me&g@home Me&g@home
Me&g@home
 
Ruby, the language of devops
Ruby, the language of devopsRuby, the language of devops
Ruby, the language of devops
 
Improve the deployment process step by step
Improve the deployment process step by stepImprove the deployment process step by step
Improve the deployment process step by step
 
Mender.io | Develop embedded applications faster | Comparing C and Golang
Mender.io | Develop embedded applications faster | Comparing C and GolangMender.io | Develop embedded applications faster | Comparing C and Golang
Mender.io | Develop embedded applications faster | Comparing C and Golang
 
Passing the Joel Test in the PHP World (phpbnl10)
Passing the Joel Test in the PHP World (phpbnl10)Passing the Joel Test in the PHP World (phpbnl10)
Passing the Joel Test in the PHP World (phpbnl10)
 
Golang nuts (by Nii Nai at DevCongress 2013)
Golang nuts (by Nii Nai at DevCongress 2013)Golang nuts (by Nii Nai at DevCongress 2013)
Golang nuts (by Nii Nai at DevCongress 2013)
 
Introduction to Go
Introduction to GoIntroduction to Go
Introduction to Go
 
JavaScript From Hell - CONFidence 2.0 2009
JavaScript From Hell - CONFidence 2.0 2009JavaScript From Hell - CONFidence 2.0 2009
JavaScript From Hell - CONFidence 2.0 2009
 

More from Suelen Carvalho

Porque Métodos Ágeis não é pra você!
Porque Métodos Ágeis não é pra você!Porque Métodos Ágeis não é pra você!
Porque Métodos Ágeis não é pra você!
Suelen Carvalho
 
Scrum: Relembrando os por quês?
Scrum: Relembrando os por quês?Scrum: Relembrando os por quês?
Scrum: Relembrando os por quês?
Suelen Carvalho
 
Techtrends xp desafios da agilidade com trabalho remoto
Techtrends xp   desafios da agilidade com trabalho remotoTechtrends xp   desafios da agilidade com trabalho remoto
Techtrends xp desafios da agilidade com trabalho remoto
Suelen Carvalho
 
Introdução a Kotlin
Introdução a KotlinIntrodução a Kotlin
Introdução a Kotlin
Suelen Carvalho
 
Introdução a Android Instant Apps
Introdução a Android Instant AppsIntrodução a Android Instant Apps
Introdução a Android Instant Apps
Suelen Carvalho
 
Google IO'17
Google IO'17Google IO'17
Google IO'17
Suelen Carvalho
 
Construindo Times de Alta Performance - Produtos & Engenharia
Construindo Times de Alta Performance - Produtos & EngenhariaConstruindo Times de Alta Performance - Produtos & Engenharia
Construindo Times de Alta Performance - Produtos & Engenharia
Suelen Carvalho
 
Git Merge e Rebase - The goal and differences
Git Merge e Rebase - The goal and differencesGit Merge e Rebase - The goal and differences
Git Merge e Rebase - The goal and differences
Suelen Carvalho
 
Dynamic Programming and Reinforcement Learning applied to Tetris Game
Dynamic Programming and Reinforcement Learning applied to Tetris GameDynamic Programming and Reinforcement Learning applied to Tetris Game
Dynamic Programming and Reinforcement Learning applied to Tetris Game
Suelen Carvalho
 
Desenvolvimento de Novos Líderes - Paidéia Educação
Desenvolvimento de Novos Líderes - Paidéia EducaçãoDesenvolvimento de Novos Líderes - Paidéia Educação
Desenvolvimento de Novos Líderes - Paidéia Educação
Suelen Carvalho
 
O sucesso do seu app está nos detalhes!
O sucesso do seu app está nos detalhes!O sucesso do seu app está nos detalhes!
O sucesso do seu app está nos detalhes!
Suelen Carvalho
 
Supporting Coding and Testing
Supporting Coding and TestingSupporting Coding and Testing
Supporting Coding and Testing
Suelen Carvalho
 
Intercon Android 2014 - Google Play In App Billing
Intercon Android 2014 - Google Play In App BillingIntercon Android 2014 - Google Play In App Billing
Intercon Android 2014 - Google Play In App Billing
Suelen Carvalho
 
Semana da Computação USP São Carlos 2014 - Carreira Mobile
Semana da Computação USP São Carlos 2014 - Carreira MobileSemana da Computação USP São Carlos 2014 - Carreira Mobile
Semana da Computação USP São Carlos 2014 - Carreira Mobile
Suelen Carvalho
 
TDC 2014 - Tudo sobre GCM Push Notifications
TDC 2014 - Tudo sobre GCM Push NotificationsTDC 2014 - Tudo sobre GCM Push Notifications
TDC 2014 - Tudo sobre GCM Push Notifications
Suelen Carvalho
 
Mobile Conf 2014 - Sua carreira e o que o desenvolvimento mobile tem a ver co...
Mobile Conf 2014 - Sua carreira e o que o desenvolvimento mobile tem a ver co...Mobile Conf 2014 - Sua carreira e o que o desenvolvimento mobile tem a ver co...
Mobile Conf 2014 - Sua carreira e o que o desenvolvimento mobile tem a ver co...Suelen Carvalho
 
Conexao Java - Sua primeira app Android
Conexao Java - Sua primeira app AndroidConexao Java - Sua primeira app Android
Conexao Java - Sua primeira app Android
Suelen Carvalho
 
7 Masters sobre Android
7 Masters sobre Android7 Masters sobre Android
7 Masters sobre Android
Suelen Carvalho
 
A história do surgimento da plataforma móvel Android.
A história do surgimento da plataforma móvel Android.A história do surgimento da plataforma móvel Android.
A história do surgimento da plataforma móvel Android.
Suelen Carvalho
 
O fantástico mundo de Android
O fantástico mundo de AndroidO fantástico mundo de Android
O fantástico mundo de AndroidSuelen Carvalho
 

More from Suelen Carvalho (20)

Porque Métodos Ágeis não é pra você!
Porque Métodos Ágeis não é pra você!Porque Métodos Ágeis não é pra você!
Porque Métodos Ágeis não é pra você!
 
Scrum: Relembrando os por quês?
Scrum: Relembrando os por quês?Scrum: Relembrando os por quês?
Scrum: Relembrando os por quês?
 
Techtrends xp desafios da agilidade com trabalho remoto
Techtrends xp   desafios da agilidade com trabalho remotoTechtrends xp   desafios da agilidade com trabalho remoto
Techtrends xp desafios da agilidade com trabalho remoto
 
Introdução a Kotlin
Introdução a KotlinIntrodução a Kotlin
Introdução a Kotlin
 
Introdução a Android Instant Apps
Introdução a Android Instant AppsIntrodução a Android Instant Apps
Introdução a Android Instant Apps
 
Google IO'17
Google IO'17Google IO'17
Google IO'17
 
Construindo Times de Alta Performance - Produtos & Engenharia
Construindo Times de Alta Performance - Produtos & EngenhariaConstruindo Times de Alta Performance - Produtos & Engenharia
Construindo Times de Alta Performance - Produtos & Engenharia
 
Git Merge e Rebase - The goal and differences
Git Merge e Rebase - The goal and differencesGit Merge e Rebase - The goal and differences
Git Merge e Rebase - The goal and differences
 
Dynamic Programming and Reinforcement Learning applied to Tetris Game
Dynamic Programming and Reinforcement Learning applied to Tetris GameDynamic Programming and Reinforcement Learning applied to Tetris Game
Dynamic Programming and Reinforcement Learning applied to Tetris Game
 
Desenvolvimento de Novos Líderes - Paidéia Educação
Desenvolvimento de Novos Líderes - Paidéia EducaçãoDesenvolvimento de Novos Líderes - Paidéia Educação
Desenvolvimento de Novos Líderes - Paidéia Educação
 
O sucesso do seu app está nos detalhes!
O sucesso do seu app está nos detalhes!O sucesso do seu app está nos detalhes!
O sucesso do seu app está nos detalhes!
 
Supporting Coding and Testing
Supporting Coding and TestingSupporting Coding and Testing
Supporting Coding and Testing
 
Intercon Android 2014 - Google Play In App Billing
Intercon Android 2014 - Google Play In App BillingIntercon Android 2014 - Google Play In App Billing
Intercon Android 2014 - Google Play In App Billing
 
Semana da Computação USP São Carlos 2014 - Carreira Mobile
Semana da Computação USP São Carlos 2014 - Carreira MobileSemana da Computação USP São Carlos 2014 - Carreira Mobile
Semana da Computação USP São Carlos 2014 - Carreira Mobile
 
TDC 2014 - Tudo sobre GCM Push Notifications
TDC 2014 - Tudo sobre GCM Push NotificationsTDC 2014 - Tudo sobre GCM Push Notifications
TDC 2014 - Tudo sobre GCM Push Notifications
 
Mobile Conf 2014 - Sua carreira e o que o desenvolvimento mobile tem a ver co...
Mobile Conf 2014 - Sua carreira e o que o desenvolvimento mobile tem a ver co...Mobile Conf 2014 - Sua carreira e o que o desenvolvimento mobile tem a ver co...
Mobile Conf 2014 - Sua carreira e o que o desenvolvimento mobile tem a ver co...
 
Conexao Java - Sua primeira app Android
Conexao Java - Sua primeira app AndroidConexao Java - Sua primeira app Android
Conexao Java - Sua primeira app Android
 
7 Masters sobre Android
7 Masters sobre Android7 Masters sobre Android
7 Masters sobre Android
 
A história do surgimento da plataforma móvel Android.
A história do surgimento da plataforma móvel Android.A história do surgimento da plataforma móvel Android.
A história do surgimento da plataforma móvel Android.
 
O fantástico mundo de Android
O fantástico mundo de AndroidO fantástico mundo de Android
O fantástico mundo de Android
 

Recently uploaded

To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
Paul Groth
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Jeffrey Haguewood
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
Laura Byrne
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
UiPathCommunity
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
Product School
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Albert Hoitingh
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
ControlCase
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Product School
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
91mobiles
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
Frank van Harmelen
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
Sri Ambati
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Product School
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
Product School
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
Cheryl Hung
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
KatiaHIMEUR1
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
BookNet Canada
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
Kari Kakkonen
 

Recently uploaded (20)

To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
 

Go lang

  • 1. Suelen Goularte Carvalho suelengc@ime.usp.br Computação Paralela e Distribuída Profº Alfredo Goldman Junho/2015
  • 2. Go is a programming language designed by Google to help solve Google's problems. What is Go? And has big problems!
  • 3. Which (big) problems? ● Hardware is big and the software is big ● There are many millions of lines of software ● Servers mostly in C++ and lots of Java and Python ● Thousands of engineers work on the code ● And of course, all this software runs on zillions of machines.
  • 4. In short, development at is big, can be slow, and is often clumsy. But it is effective. '' '' https://talks.golang.org/2012/splash.article
  • 5. A lot of others people help to bring go from prototype to reality. Go became a public Open Source project. https://golang.org/doc/faq#history 2008 2009 20102007 Starts to have adoption by other programmers Started and built by Robert Griesemer, Rob Pike and Ken Thompson as a part-time project. History
  • 6. ● Ken Thompson (B, C, Unix, UTF-8) ● Rob Pike (Unix, UTF-8) ● Robert Griesemer (Hotspot, JVM) ...and a few others engineers at Google Who were the founders?
  • 7. 2013 20142012 Version history Go 1.4 (December) Go 1.3 (June) Go 1 (March) Go 1.2 (December) Go 1.1 (May) https://golang.org/project/
  • 8. ● Eliminate slowness ● Eliminate clumsiness ● Improve productive ● Maintain (and improve) scale It was designed by and for people who write, read, debug and maintain large software systems. Go's purpose is not to do research programming language design. Go's purpose is to make its designers' programming lives better. Why Go?
  • 9. Go is a compiled, concurrent, garbage-collected, statically typed language developed at . What is Go?
  • 10. fix, fmt, get, install, list, tool, version, vet. build compile packages and dependencies run compile and run Go program clean remove object files env print Go environment information test test packages and benchmarks Go is a tool for managing Go source code... Mainly tools: Others tools:
  • 11. Who are using today? https://github.com/golang/go/wiki/GoUsers
  • 12. ❏ Compiled ❏ Garbage-collected ❏ Has your own runtime ❏ Simple syntax ❏ Great standard library ❏ Cross-platform ❏ Object Oriented (without inheritance) ❏ Statically and stronger typed ❏ Concurrent (goroutines) ❏ Closures ❏ Explicity dependencies ❏ Multiple return values ❏ Pointers ❏ and so on... What will you see in Go?
  • 13. Have not been implemented in favor of efficiency. ❏ Exception handling ❏ Inheritance ❏ Generics ❏ Assert ❏ Method overload What will you not see in Go?
  • 14. see a bit of code!
  • 15. Packages ● Each Go program are compound per packages ● Programs starts from main package ● This example are using the ftm and math packages $ go run packages.go My favorite number is 1
  • 16. ● The var instruction declares a list of variables ● The type is informed at the end ● The var instruction could be in a package or in a function ● The var instruction could includes initializers, 1 per variable. In this case, the type could be ommited because it will be inferred Variables $ go run variables.go 0 false false false $ go run variables-with-initiali 1 2 true false no!
  • 17. $ go run constants.go Hello world! Happy 3.14 Day! Go rules? true ● Constants are declared like variables but with keyword const ● Can not use the syntx := Constants
  • 18. ● Inside a function, the short attribution instruction := can be used instead of a var declaration Short variables declarations $ go run short-variable-declarations.go 1 2 3 true false no!
  • 19. Functions ● Functions could have zero or more arguments ● Notice that the type comes after the parameter name, like variables $ go run functions.go 55
  • 20. ● A function can have multiple return values Multiple return values $ go run multiple-results.go world hello
  • 21. ● Go has just for as looping structure ● It is very similar with C or Java code, except for ( ) ● Start and end declarations can be empty Looping For $ go run for.go 45 $ go run for-continu 1024
  • 22. $ go run for-is-go-while.go 1024 ● Semicolon can be removed and you will have while ● for can run forever Looping "while" and forever $ go run forever.go process took too long
  • 23. ● It is very similar with C or Java code, except for ( ) if Condition $ go run if.go 1.4142135623730951 2i
  • 24. $ go run switch.go Go runs on nacl. ● It is very similar with C or Java code, except for ( ) Switch Condition
  • 25. $ go run defer.go hello world Defer ● Postponing the execution of a function until the function returns ● The arguments of the deferred calls are evaluated immediately
  • 26. What more? ● Pointer ● Struct ● Matrix ● Slice ● Range ● Map ● Value function ● Closures ● Method ● Interface ● Stringer ● Error ● and a lot of more!!! http://go-tour-br.appspot.com
  • 27. $ go run http.go A web server ● It is just simple to build a web server with 15 lines or less!! Could you belive that???
  • 28. ● To execute a goroutine, just go! ● To send or receive information between the goroutines, use channels ● Use the GOMAXPROCS environment variable to define the amount of threads Concurrency (goroutines)
  • 29. $ go run goroutines.go hello world hello world hello world hello world hello ● A goroutine is a lightweight thread managed by Go runtime Goroutines
  • 30. $ go run channels.go 17 -5 12 Channels ● Channels are typed's conduit through which you can send and receive values with the channel operator <-
  • 33. Now you are ready to !
  • 34. Bibliografia ❏ http://golang.org ❏ http://go-tour-br.appspot.com/ ❏ https://tour.golang.org ❏ http://www.golangbr.org/ ❏ https://vimeo.com/49718712 ❏ http://gophercon.com ❏ http://www.infoq.com/br/news/2014/09/go-1-3 ❏ http://www.casadocodigo.com.br/products/livro-google-go ❏ https://pt.wikipedia.org/wiki/Inferno_(sistema_operacional) ❏ http://www.grokpodcast.com/series/a-linguagem-go/ ❏ https://pt.wikipedia.org/wiki/Go_(linguagem_de_programação) ❏ https://gobyexample.com ❏ http://www.goinggo.net/2014/02/the-nature-of-channels-in-go.html ❏ http://www.goinggo.net/2013/09/detecting-race-conditions-with-go.html?m=1 ❏ https://en.wikipedia.org/wiki/Green_threads ❏ http://www.toptal.com/go/go-programming-a-step-by-step-introductory-tutorial