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
Golangの紹介(基礎)
Search
Yusuke AONO
October 28, 2014
Programming
0
170
Golangの紹介(基礎)
Yusuke AONO
October 28, 2014
Tweet
Share
More Decks by Yusuke AONO
See All by Yusuke AONO
Webアプリのテスト(Atrae社内勉強会)
ysk1031
1
100
Twilioの簡単な説明
ysk1031
1
66
Other Decks in Programming
See All in Programming
初めてDefinitelyTypedにPRを出した話
syumai
0
180
3rd party scriptでもReactを使いたい! Preact + Reactのハイブリッド開発
righttouch
PRO
1
590
Identifying User Idenity
moro
6
9.7k
Jakarta EE meets AI
ivargrimstad
0
230
シールドクラスをはじめよう / Getting Started with Sealed Classes
mackey0225
3
430
Kaigi on Rails 2024 - Rails APIモードのためのシンプルで効果的なCSRF対策 / kaigionrails-2024-csrf
corocn
5
3.8k
Enabling DevOps and Team Topologies Through Architecture: Architecting for Fast Flow
cer
PRO
0
200
ActiveSupport::Notifications supporting instrumentation of Rails apps with OpenTelemetry
ymtdzzz
1
210
Compose 1.7のTextFieldはPOBox Plusで日本語変換できない
tomoya0x00
0
170
Java ジェネリクス入門 2024
nagise
0
700
見せてあげますよ、「本物のLaravel批判」ってやつを。
77web
7
7.4k
AWS Lambdaから始まった Serverlessの「熱」とキャリアパス / It started with AWS Lambda Serverless “fever” and career path
seike460
PRO
1
210
Featured
See All Featured
Statistics for Hackers
jakevdp
796
220k
Unsuck your backbone
ammeep
668
57k
Fireside Chat
paigeccino
33
3k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
47
5k
Art, The Web, and Tiny UX
lynnandtonic
297
20k
Build The Right Thing And Hit Your Dates
maggiecrowley
33
2.4k
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
191
16k
The Power of CSS Pseudo Elements
geoffreycrofte
73
5.3k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
7
570
Teambox: Starting and Learning
jrom
133
8.8k
Automating Front-end Workflow
addyosmani
1366
200k
Transcript
Goݴޠೖͷೖ 2014/10/28 Atraeࣾษڧձ
Goݴޠͱ • 2009ʹൃද͞ΕͨΦʔϓϯιʔεͷݴޠ • Google͕։ൃ • CݴޠɺUTF-8ɺmemcachedͷ։ൃऀΒ͕ઃ ܭʹࢀՃ • ݱࡏόʔδϣϯ1.3.3
ಛ • ੩తͳܕ͖ݴޠ • γϯϓϧʢͳߏจʣ • ʮྫ֎ʯ͕ແ͔ͬͨΓ͢Δ • ίϯύΠϧɺ࣮ߦ͕͍ •
҆શੑ͕ߴ͍ • ྫɿະ༻ͷมύοέʔδ͕͋ΔͱɺίϯύΠϧ௨Βͳ͍ • ฒྻॲཧָ͕ʹॻ͚Δ
࠾༻ࣄྫ • ίϚϯυϥΠϯπʔϧϛυϧΣΞʹΘΕΔ͜ͱଟ͠ɻ ·ͩRailsతͳఆ൪ແ͍ײ͕ͩ͡ɺWAF͋Δ • peco • hub • Docker
• Packer • mackerel
Πϯετʔϧ • MacͳΒɺhomebrew͏͕ΑΖ͠ • GOPATHͱ͍͏ڥมͷઃఆ͕ඞཁͰ͢ • ੨ϗʔϜσΟϨΫτϦΛઃఆͯ͠Δ • ڥߏஙΊΜͲ͍ਓɺGolangͷαΠτͰͱΓ͋͑ ͣಈ͔͢ͷ͕Φεεϝ
• http://play.golang.org/p/-URiXol0GB
ϋϩʔϫʔϧυ
ϓϩάϥϜͷ࣮ߦ • ຊདྷίϯύΠϧΛͯ͠͏ݴޠ • ͕ɺgo run ίϚϯυͰɺίϯύΠϧ͠ͳͯ͘ ࣮ߦՄೳ • ίϯύΠϧɺgo
build ίϚϯυͰ • ίϯύΠϧͰੜ͞ΕΔͷɺ࣮ߦܗࣜͷόΠ φϦϑΝΠϧ
ϑΥʔϚοτ • ͭ͡ίʔσΟϯάن͕͔ͳΓݫ͍͠ • Πϯσϯτɺϋʔυλϒ͡Όͳ͖Όμϝ • ֯εϖʔεΛೖΕΔ/ೖΕͳ͍ॴ etc. • ࣗ༝͕͍ɺ౷Ұੑ͕ੜ·ΕΔ
• go fmt ίϚϯυͰࣗಈܗՄೳ • ࣗಈͰߏจνΣοΫͯ͘͠ΕΔϓϥάΠϯ͕ɺ͍͍ͩͨͷΤ σΟλʹ͋Δʢඞਢͩͱࢥ͏ʣ
جຊจ๏ • εϥΠυʹ͢ΔͷΊΜͲ͍ ϒϩάʹॻ͍ͨ • http://yusuke-aono.hatenablog.com/entry/ 20141026/1414313149
Goroutine • Goݴޠͷେ͖ͳಛͷҰͭɺಉظʢฒߦॲ ཧʣϓϩάϥϛϯάΛ؆୯ʹ࣮ݱ͢Δػೳ • ಡΈํΰϧʔνϯ • ͍ΘΏΔεϨουతͳͷ • main()
ؔ1ͭͷΰϧʔνϯͷதͰ࣮ߦ͞Ε ͍ͯͨ
Not Goroutine
Goroutine (ʆŋωŋ´)ʎ
Channel • ෳͷΰϧʔνϯؒͰσʔλΛΓͱΓ͢Δ ʹʁ • ͦͷࡍʹ͏ͷ͕ɺνϟωϧ • ΈࠐΈͷ make() ؔΛར༻
Channelͷར༻
νϟωϧɺͲ͏͑Δ͔ • ྫ͑ɺಉ࣌ʹෳͷαʔόʔʹϦΫΤε τΛग़ͯ͠େྔͷ໋ྩͱେྔͷσʔλΛฒྻ ॲཧ͢ΔϓϩάϥϜɺͱ͔ʁ • GoͷϛυϧΣΞ͕ଟ͍ͷɺGoroutine ͱChannelͷଘࡏ͕͋Δ͔ΒͩͱࢥΘΕΔ
GoͷWAF • Revel • Martini • Goji • net/http and
so on. SinatraͬΆ͍ͷ͔ΒRailsΈ͍ͨͳશ෦ೖΓ·Ͱ৭ʑ͋Δɻ ৮ͬͯࢼ࣌ؒ͢ͳ͔ͬͨɺ͢Μ·ͤΜɻɻ
·ͱΊ • γϯϓϧʹ࡞ΒΕ͍ͯͯɺ݁ߏ͍֮͑͢ • ίϯύΠϧ࣌ʹνΣοΫͯ͘͠ΕΔͷྑ͍ʢϙΧϛεݮΔʣ • ฒྻॲཧ͕؆୯ʹॻ͚ͯͼͼΔ • ͱ͍͑ɺ੩తܕ͚ίʔσΟϯάͷεϐʔυײ͕ଟগམ ͪΔͩΖ͏ʢಛʹRubyʹͱͬͯʣ
• ܭࢉʢߦྻͷੵͱ͔ʣॲཧೳྗͱ͔ɺWAFͱͯ͠ͷ͍ ͢͞ͱ͔͏গ͠ௐͯΈ·͢