Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Introdução a Go
Search
Elton Minetto
May 11, 2022
Programming
1
190
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
Criando Kubernetes Operators com o operator-sdk
eminetto
0
54
Developer productivity for fun and profit - Enterprise edition
eminetto
0
48
Criando Kubernetes Operators com o operator-sdk
eminetto
0
60
Developer productivity for fun and profit - Developer edition
eminetto
3
450
Observabilidade de APIs
eminetto
1
820
Reflexões sobre Design de Software
eminetto
1
390
Discussões sobre microsserviços
eminetto
0
56
Go, o que, por que e como?
eminetto
0
280
Dev Journey
eminetto
0
410
Other Decks in Programming
See All in Programming
これからの時代の新標準!SwiftTestingへの移行とトラブルシューティング
uetyo
0
440
Appleの新しいプライバシー要件対応: ノーコードアプリ プラットフォームの実践事例
nao_randd
1
450
開発を加速する共有Swift Package実践
elmetal
PRO
0
300
TypeScriptとGraphQLを活用した変化に強いプロダクト作り
bicstone
4
550
Wallet API, Verifier APIで実現するIDカード on iPhoneの世界
shitamori1272
1
320
Rubyとクリエイティブコーディングの輪の広がり / The Growing Circle of Ruby and Creative Coding
chobishiba
1
220
ECMAScript、Web標準の型はどう管理されているか / How ECMAScript and Web standards types are maintained
petamoriken
3
370
数値を文字列に整形する際の落とし穴とその解決策(iOSDC2024 ルーキーズLT) / iOSDC Japan 2024 Formatting Floating-Point Numbers
glassfiber
0
250
詳解UIWindow
natmark
3
2k
月間4.5億回再生を超える大規模サービス TVer iOSアプリのリアーキテクチャ戦略 - iOSDC2024
techtver
PRO
1
570
楽しく簡単に!QRコードの読み取り機能を実装しよう
penguinsan_pg
1
190
実践 Advanced CallKit 〜快適な通話の実現に向けて〜
mot_techtalk
3
110
Featured
See All Featured
Teambox: Starting and Learning
jrom
131
8.7k
Rebuilding a faster, lazier Slack
samanthasiow
78
8.5k
The MySQL Ecosystem @ GitHub 2015
samlambert
250
12k
How STYLIGHT went responsive
nonsquared
93
5.1k
Being A Developer After 40
akosma
82
580k
Imperfection Machines: The Place of Print at Facebook
scottboms
263
13k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
26
1.9k
YesSQL, Process and Tooling at Scale
rocio
167
14k
Designing the Hi-DPI Web
ddemaree
278
34k
jQuery: Nuts, Bolts and Bling
dougneiner
61
7.4k
Build The Right Thing And Hit Your Dates
maggiecrowley
29
2.2k
Learning to Love Humans: Emotional Interface Design
aarron
270
40k
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
[email protected]
http://eltonminetto.dev http://twitter.com/eminetto