Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Speaker Deck
PRO
Sign in
Sign up for free
Introdução a Go
Elton Minetto
May 11, 2022
Programming
1
26
Introdução a Go
Nesta palestra faço uma introdução a linguagem Go
Elton Minetto
May 11, 2022
Tweet
Share
More Decks by Elton Minetto
See All by Elton Minetto
Reflexões sobre Design de Software
eminetto
0
10
Go, o que, por que e como?
eminetto
0
78
Dev Journey
eminetto
0
250
Microsserviços usando Go kit
eminetto
0
170
Arquitetura de software e a Clean Architecture
eminetto
4
890
Da ideia ao Speaker Deck
eminetto
0
150
Por que e como usamos Go na Codenation?
eminetto
1
260
Clean Architecture using Go
eminetto
1
410
A jornada do desenvolvedor
eminetto
1
110
Other Decks in Programming
See All in Programming
Get Ready for Jakarta EE 10
ivargrimstad
0
1.8k
Android スキルセットをフル活用して始めるスマートテレビアプリ開発
satsukies
1
190
What's new in Android development tools まとめ
mkeeda
0
290
RFC 9111: HTTP Caching
jxck
0
150
Custom Design Systems in Compose UI
rharter
5
520
開発速度を5倍早くするVSCodeの拡張機能を作った
purp1eeeee
2
150
Scrum Fest Osaka 2022/5年で200人になったスタートアップの アジャイル開発の歴史とリアル
atamaplus
1
820
1時間半で克服するJavaScriptの非同期処理/async_javascript_kokufuku
marchin1989
2
600
Gitlab CIでMRを自動生成する
forcia_dev_pr
0
110
模組化的Swift架構(二) DDD速成
haifengkao
0
370
GoogleI/O2022 LT報告会資料
shinsukefujita1126
0
290
IE Graduation (IE の功績を讃える)
jxck
20
12k
Featured
See All Featured
The Straight Up "How To Draw Better" Workshop
denniskardys
225
120k
Six Lessons from altMBA
skipperchong
14
1.4k
What's in a price? How to price your products and services
michaelherold
229
9.4k
Keith and Marios Guide to Fast Websites
keithpitt
404
21k
10 Git Anti Patterns You Should be Aware of
lemiorhan
638
52k
The MySQL Ecosystem @ GitHub 2015
samlambert
238
11k
Making Projects Easy
brettharned
98
4.3k
Designing for humans not robots
tammielis
241
23k
Stop Working from a Prison Cell
hatefulcrawdad
261
17k
Happy Clients
brianwarren
89
5.6k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
12
920
How GitHub (no longer) Works
holman
296
140k
Transcript
Introdução a Go
Elton Minetto ๏ Escrevo códigos, sou professor, palestrante, e escritor
๏ Escrevo no https://eltonminetto.dev e no twitter ๏ Sou Principal Software Engineer no PicPay
O que é?
Uma linguagem open source
None
Por que uma nova linguagem?
Muitos problemas com software em grande escala
Velocidade de compilação
Sistemas distribuídos Multicore
Objetivos
Semântica simples
Tipagem estática
Programação concorrente
Divertida!
TALK IS CHEAP, SHOW ME THE CODE!
Pacotes package main import ( "fmt" "math" ) func main()
{ fmt.Printf("Now you have %g problems.", math.Sqrt(7)) }
Resultados Múltiplos package main import "fmt" func swap(x, y string)
(string, string) { return y, x } func main() { a, b := swap("hello", "world") fmt.Println(a, b) }
Erros package main import "github.com/coderockr/nfe/transmitter" func main() { response, err
:= transmitter.transmit(nfe, xml) if err != nil { panic("Error ") //tratamento de erro qualquer } result, err := transmitter.saveData(response, xml) if err != nil { panic("Error ") //tratamento de erro qualquer } }
Goroutines package main import ( "fmt" "time" ) func say(s
string) { for i := 0; i < 5; i++ { time.Sleep(100 * time.Millisecond) fmt.Println(s) } } func main() { go say("world") say("hello") }
Canais package main import "fmt" func sum(s []int, c chan
int) { sum := 0 for _, v := range s { sum += v } c <- sum // send sum to c } func main() { s := []int{7, 2, 8, -9, 4, 0} c := make(chan int) go sum(s[:len(s)/2], c) go sum(s[len(s)/2:], c) x, y := <-c, <-c // receive from c fmt.Println(x, y, x+y) }
Cross Compilation GOOS=darwin GOARCH=amd64 go build gorotines.go GOOS=windows GOARCH=amd64 go
build gorotines.go GOOS=linux GOARCH=amd64 go build gorotines.go
OO via composição e não herança, biblioteca padrão poderosa, etc.
Quem está usando?
Google, Basecamp, Globo.com, Canonical, DigitalOcean, Dropbox, Github, Heroku, Medium, Docker,
MongoDB, Mozilla, Netflix, New Relic, New York Times, Resultados Digitais, Moip, Neoway, Walmart, Trybe, PicPay, etc https://github.com/golang/go/wiki/GoUsers
Aplicações
APIs
Microservices
IoT
Databases
CLIents
Material de estudo
Site oficial Tour Go, por onde começar? Livro: A Linguagem
de Programação Go Curso Desenvolvimento Web com Go Awesome Go
Contato elton@minetto.dev http://eltonminetto.dev http://twitter.com/eminetto