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
let's go
Search
Andrews Medina
May 11, 2013
Programming
2
300
let's go
Uma introdução sobre a linguagem go no devcamp 2013
Andrews Medina
May 11, 2013
Tweet
Share
More Decks by Andrews Medina
See All by Andrews Medina
Organizando dados juŕidicos em grafos
andrewsmedina
0
90
Clean Code - princípios e práticas para um código sustentável
andrewsmedina
0
560
Pytfalls
andrewsmedina
1
180
tsuru para quem sabe tsuru
andrewsmedina
0
71
globo.com s2 python
andrewsmedina
5
360
tsuru and docker
andrewsmedina
6
3.5k
pypy - o interpretador mais rapido do velho oeste
andrewsmedina
0
360
fazendo deploys de forma simples e divertida com tsuru
andrewsmedina
3
140
TDD for Dummies
andrewsmedina
3
360
Other Decks in Programming
See All in Programming
『ドメイン駆動設計をはじめよう』のモデリングアプローチ
masuda220
PRO
8
540
Compose 1.7のTextFieldはPOBox Plusで日本語変換できない
tomoya0x00
0
190
リアーキテクチャxDDD 1年間の取り組みと進化
hsawaji
1
220
Micro Frontends Unmasked Opportunities, Challenges, Alternatives
manfredsteyer
PRO
0
110
Tauriでネイティブアプリを作りたい
tsucchinoko
0
370
Make Impossible States Impossibleを 意識してReactのPropsを設計しよう
ikumatadokoro
0
230
とにかくAWS GameDay!AWSは世界の共通言語! / Anyway, AWS GameDay! AWS is the world's lingua franca!
seike460
PRO
1
890
聞き手から登壇者へ: RubyKaigi2024 LTでの初挑戦が 教えてくれた、可能性の星
mikik0
1
130
イベント駆動で成長して委員会
happymana
1
330
Contemporary Test Cases
maaretp
0
140
Remix on Hono on Cloudflare Workers
yusukebe
1
300
アジャイルを支えるテストアーキテクチャ設計/Test Architecting for Agile
goyoki
9
3.3k
Featured
See All Featured
Thoughts on Productivity
jonyablonski
67
4.3k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
329
21k
It's Worth the Effort
3n
183
27k
Statistics for Hackers
jakevdp
796
220k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
665
120k
10 Git Anti Patterns You Should be Aware of
lemiorhan
655
59k
Imperfection Machines: The Place of Print at Facebook
scottboms
265
13k
Large-scale JavaScript Application Architecture
addyosmani
510
110k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
356
29k
RailsConf 2023
tenderlove
29
900
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
31
2.7k
What's new in Ruby 2.0
geeforr
343
31k
Transcript
let’s go @andrewsmedina http://andrewsmedina.com let’s go Saturday, May 11, 2013
globo .com @andrewsmedina ‣ dev na globo.com ‣ faz parte
do time do tsuru paas ‣ contribui com projetos opensource (django, circus, splinter...) ‣ profeta nas horas vagas Saturday, May 11, 2013
globo .com por que go? Saturday, May 11, 2013
globo .com linguagens estáticas ‣ rápidas ‣ erros a nível
de compilação Saturday, May 11, 2013
globo .com http://www.thinkgeek.com/product/dac0/ Saturday, May 11, 2013
globo .com linguagens estáticas ‣ verbosas ‣ build lento Saturday,
May 11, 2013
globo .com linguagens dinâmicas ‣ sintaxe agradável Saturday, May 11,
2013
globo .com http://media.npr.org/assets/img/2012/08/20/slow-f7c667bbe3c1b9c54cf5061ade96c6799cef281b-s6-c10.jpg Saturday, May 11, 2013
globo .com linguagens dinâmicas ‣ lentas ‣ erro em runtime
Saturday, May 11, 2013
globo .com goals ‣ concorrência ‣ eficiência ‣ fácil ‣
divertida Saturday, May 11, 2013
globo .com let’s go Saturday, May 11, 2013
globo .com hello world package main import "fmt" func main()
{ fmt.Println("hello devcamp!") } Saturday, May 11, 2013
globo .com hello world 2 - a missão package main
import "fmt" func main() { nome := “andrews” fmt.Printf("meu nome é %s\n", nome) } Saturday, May 11, 2013
globo .com tipagem (estática) ‣ estática ‣ inferência de tipos
Saturday, May 11, 2013
globo .com for package main import "fmt" func main() {
for i := 0; i <= 10; i++ { fmt.Println(i) } } Saturday, May 11, 2013
globo .com primos func ehPrimo(numero int) bool { for i
:= 2; i < numero; i++ { if numero % i == 0 { return false } } return true } Saturday, May 11, 2013
globo .com primos cont.. func main() { numeros := []int{3,
5, 6, 7, 10, 11, 22, 32, 43, 111} for _, numero := range numeros { if ehPrimo(numero) { fmt.Printf("%d é primo.\n", numero) } } } Saturday, May 11, 2013
globo .com slices ‣ []type{item1, item2...} ‣ []int{1,2,3} Saturday, May
11, 2013
globo .com maps ‣ map[type]type ‣ map[string]string Saturday, May 11,
2013
globo .com types type Carro struct { Modelo string }
Saturday, May 11, 2013
globo .com types c := Carro{Modelo: "Gol"} Saturday, May 11,
2013
globo .com methods type Carro struct { Modelo string }
func (c *Carro) Acelera() { fmt.Printf("acelerando um %s...\n", c.Modelo) } Saturday, May 11, 2013
globo .com methods c := Carro{Modelo: "Gol"} c.Acelera() Saturday, May
11, 2013
globo .com interfaces type Aceleravel interface { Acelera() } Saturday,
May 11, 2013
globo .com interfaces type Moto struct { Modelo string }
func (m *Moto) Acelera() { fmt.Printf("vrummmmm\n") } Saturday, May 11, 2013
globo .com interfaces func aceleraQualquerCoisa(items []Aceleravel) { for _, aceleravel
:= range items { aceleravel.Acelera() } } Saturday, May 11, 2013
globo .com interfaces c := Carro{Modelo: "Gol"} m := Moto{Modelo:
"Harley"} aceleraQualquerCoisa([]Aceleravel{&c, &m}) Saturday, May 11, 2013
globo .com concorrência Saturday, May 11, 2013
globo .com bebedouro func main() { pessoas := []string{"andrews", "linus",
"fowler"} for _, p := range pessoas { pegaAgua(p) go bebeAgua(p) } time.Sleep(1) } Saturday, May 11, 2013
globo .com goroutine ‣ “go” Saturday, May 11, 2013
globo .com channels func soma(x, y int, c chan int)
{ c <- x + y } func main() { c := make(chan int) go soma(1, 1, c) go soma(2, 2, c) x, y := <-c, <-c fmt.Println(x+y) } Saturday, May 11, 2013
globo .com channels ‣ <- ‣ chan int Saturday, May
11, 2013
globo .com baterias incluídas ‣ crypto ‣ encoding ‣ html/template
‣ image ‣ log/syslog ‣ net/http, net/mail, net/smtp Saturday, May 11, 2013
globo .com baterias incluídas package main import ( "fmt" "net/http"
) func main() { http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { fmt.Fprintln(w, "devcamp 2013") }) http.ListenAndServe("127.0.0.1:3333", nil) } Saturday, May 11, 2013
globo .com baterias incluídas package main import ( "os" "text/template"
) func main() { t, _ := template.New("foo").Parse("Hello, {{.}}!") t.Execute(os.Stdout, "devcamp 2013") } Saturday, May 11, 2013
globo .com quem já está usando go ‣ google ‣
heroku ‣ mozilla ‣ globo.com ‣ canonical Saturday, May 11, 2013
globo .com #comofaz? ‣ http://tour.golang.org/ ‣ http://golang.org/doc/install ‣ http://golang.org/doc/code.html ‣
http://golang.org/doc/effective_go.html Saturday, May 11, 2013
let’s go @andrewsmedina http://andrewsmedina.com dúvidas? Saturday, May 11, 2013